mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-11 01:20:08 -04:00
Merge pull request #160 from iptv-org/add-tvim-tv
Add guide from tvim.tv
This commit is contained in:
commit
18c4c607ec
3 changed files with 119 additions and 0 deletions
45
sites/tvim.tv/tvim.tv.config.js
Normal file
45
sites/tvim.tv/tvim.tv.config.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
const dayjs = require('dayjs')
|
||||
|
||||
module.exports = {
|
||||
site: 'tvim.tv',
|
||||
url: function ({ date, channel }) {
|
||||
return `https://www.tvim.tv/script/program_epg?date=${date.format('DD.MM.YYYY')}&prog=${
|
||||
channel.site_id
|
||||
}&server_time=true`
|
||||
},
|
||||
logo({ channel }) {
|
||||
return `https://mobile-api.tvim.tv/images/channels/120x60px/${channel.site_id}.png`
|
||||
},
|
||||
parser: function ({ content, channel, date }) {
|
||||
let programs = []
|
||||
const items = parseItems(content)
|
||||
items.forEach(item => {
|
||||
const start = parseStart(item)
|
||||
const stop = parseStop(item)
|
||||
|
||||
programs.push({
|
||||
title: item.title,
|
||||
description: item.desc,
|
||||
category: item.genre,
|
||||
start: start.toString(),
|
||||
stop: stop.toString()
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
}
|
||||
}
|
||||
|
||||
function parseStart(item) {
|
||||
return dayjs.unix(item.from_utc)
|
||||
}
|
||||
|
||||
function parseStop(item) {
|
||||
return dayjs.unix(item.end_utc)
|
||||
}
|
||||
|
||||
function parseItems(content, channel) {
|
||||
const parsed = JSON.parse(content)
|
||||
|
||||
return parsed.data.prog || []
|
||||
}
|
42
sites/tvim.tv/tvim.tv.test.js
Normal file
42
sites/tvim.tv/tvim.tv.test.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
// npx epg-grabber --config=sites/tvim.tv/tvim.tv.config.js --channels=sites/tvim.tv/tvim.tv_xk.channels.xml --days=2 --output=.gh-pages/guides/xk/tvim.tv.epg.xml
|
||||
|
||||
const { parser, url, logo } = require('./tvim.tv.config.js')
|
||||
const dayjs = require('dayjs')
|
||||
|
||||
const date = dayjs('10/24/2021')
|
||||
const channel = { site_id: 'T7', xmltv_id: 'T7.rs' }
|
||||
const content = `{"response":"ok","data":{"thumb":"https://mobile-api.tvim.tv/images/chan_logos/70x25/T7.png","thumb_rel":"https://mobile-api.tvim.tv/images/chan_logos/70x25/T7.png","thumb_large_rel":"https://mobile-api.tvim.tv/images/chan_logos/120x60/T7.png","thumb_http":"http://mobile-api.tvim.tv/images/chan_logos/70x25/T7.png","thumb_large":"http://mobile-api.tvim.tv/images/chan_logos/120x60/T7.png","server_time":1635100951,"catchup_length":2,"_id":"T73","ind":2,"genre":"national","name":"T7","epg_id":"T7","chan":"T7","prog":[{"id":"T7-1635026400","title":"Programi i T7","from":1635026400,"end":1635040800,"starting":"00:00","from_utc":1635026400,"end_utc":1635040800,"desc":"Programi i T7","genre":"test","chan":"T7","epg_id":"T7","eng":""}]}}`
|
||||
|
||||
it('can generate valid url', () => {
|
||||
const result = url({ date, channel })
|
||||
expect(result).toBe(
|
||||
'https://www.tvim.tv/script/program_epg?date=24.10.2021&prog=T7&server_time=true'
|
||||
)
|
||||
})
|
||||
|
||||
it('can get logo url', () => {
|
||||
const result = logo({ channel })
|
||||
expect(result).toBe('https://mobile-api.tvim.tv/images/channels/120x60px/T7.png')
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const result = parser({ date, channel, content })
|
||||
expect(result).toMatchObject([
|
||||
{
|
||||
start: 'Sat, 23 Oct 2021 22:00:00 GMT',
|
||||
stop: 'Sun, 24 Oct 2021 02:00:00 GMT',
|
||||
title: 'Programi i T7',
|
||||
description: `Programi i T7`,
|
||||
category: 'test'
|
||||
}
|
||||
])
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const result = parser({
|
||||
date,
|
||||
channel,
|
||||
content: `{"response":"ok","data":{"server_time":1635100927}}`
|
||||
})
|
||||
expect(result).toMatchObject([])
|
||||
})
|
32
sites/tvim.tv/tvim.tv_xk.channels.xml
Normal file
32
sites/tvim.tv/tvim.tv_xk.channels.xml
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<site site="tvim.tv">
|
||||
<channels>
|
||||
<channel lang="sq" xmltv_id="BabyTVEurope.uk" site_id="BABYTV">Baby TV Europe</channel>
|
||||
<channel lang="sq" xmltv_id="BangBang.al" site_id="BANGBANG">Bang Bang</channel>
|
||||
<channel lang="sq" xmltv_id="BoomerangCentralEasternEurope.us" site_id="BOOMERANG">Boomerang Central & Eastern Europe</channel>
|
||||
<channel lang="sq" xmltv_id="Cufo.al" site_id="CUFOTV">Çufo</channel>
|
||||
<channel lang="sq" xmltv_id="Eurosport1.fr" site_id="EUROSPORT">Eurosport 1</channel>
|
||||
<channel lang="sq" xmltv_id="ExplorerHistori.al" site_id="EXPHISTORI">Explorer Histori</channel>
|
||||
<channel lang="sq" xmltv_id="ExplorerNatyra.al" site_id="EXPNATYRA">Explorer Natyra</channel>
|
||||
<channel lang="sq" xmltv_id="ExplorerShkence.al" site_id="EXPSHKENCE">Explorer Shkencë</channel>
|
||||
<channel lang="sq" xmltv_id="FamilyHD.al" site_id="FAMILY">Family HD</channel>
|
||||
<channel lang="sq" xmltv_id="FilmAksion.al" site_id="FILMAKSION">Film Aksion</channel>
|
||||
<channel lang="sq" xmltv_id="FilmDyHD.al" site_id="FILMDY">Film Dy HD</channel>
|
||||
<channel lang="sq" xmltv_id="FilmKomedi.al" site_id="FILMKOMEDI">Film Komedi</channel>
|
||||
<channel lang="sq" xmltv_id="FoxLifeRegional.us" site_id="FOXLIFE">Fox Life Regional</channel>
|
||||
<channel lang="sq" xmltv_id="FoxSrbija.us" site_id="FOX">Fox Srbija</channel>
|
||||
<channel lang="sq" xmltv_id="JuniorTV.al" site_id="JUNIORTV">Junior TV</channel>
|
||||
<channel lang="sq" xmltv_id="Kohavision.rs" site_id="KTV">Kohavision</channel>
|
||||
<channel lang="sq" xmltv_id="SuperSport2.al" site_id="SS2">SuperSport 2</channel>
|
||||
<channel lang="sq" xmltv_id="SuperSport3.al" site_id="SS3">SuperSport 3</channel>
|
||||
<channel lang="sq" xmltv_id="SuperSport4.al" site_id="SS4">SuperSport 4</channel>
|
||||
<channel lang="sq" xmltv_id="SuperSport5.al" site_id="SS5">SuperSport 5</channel>
|
||||
<channel lang="sq" xmltv_id="SuperSport6.al" site_id="SS6">SuperSport 6</channel>
|
||||
<channel lang="sq" xmltv_id="SuperSportKosova1.al" site_id="SSKOSOVA1">SuperSport Kosova 1</channel>
|
||||
<channel lang="sq" xmltv_id="SuperSportKosova2.al" site_id="SSKOSOVA2">SuperSport Kosova 2</channel>
|
||||
<channel lang="sq" xmltv_id="SuperSportKosova3.al" site_id="SSKOSOVA3">SuperSport Kosova 3</channel>
|
||||
<channel lang="sq" xmltv_id="T.al" site_id="TCHANNEL">T</channel>
|
||||
<channel lang="sq" xmltv_id="T7.rs" site_id="T7">T7</channel>
|
||||
<channel lang="sq" xmltv_id="TopChannel.al" site_id="TOPCHANNEL">Top Channel</channel>
|
||||
</channels>
|
||||
</site>
|
Loading…
Add table
Add a link
Reference in a new issue