diff --git a/SITES.md b/SITES.md index f71c8c68..985af6d3 100644 --- a/SITES.md +++ b/SITES.md @@ -59,7 +59,7 @@ | [iltalehti.fi](sites/iltalehti.fi) | 🟡 | https://github.com/iptv-org/epg/issues/2396 | | [indihometv.com](sites/indihometv.com) | 🟢 | | | [ionplustv.com](sites/ionplustv.com) | 🟢 | | -| [ipko.com](sites/ipko.com) | 🔴 | https://github.com/iptv-org/epg/issues/2454 | +| [ipko.tv](sites/ipko.tv) | 🟢 | | | [kan.org.il](sites/kan.org.il) | 🔴 | https://github.com/iptv-org/epg/issues/2273 | | [knr.gl](sites/knr.gl) | 🟢 | | | [kplus.vn](sites/kplus.vn) | 🔴 | https://github.com/iptv-org/epg/issues/2240 | diff --git a/sites/ipko.com/ipko.com.channels.xml b/sites/ipko.com/ipko.com.channels.xml deleted file mode 100644 index 6dc8ea31..00000000 --- a/sites/ipko.com/ipko.com.channels.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - Radio Televizioni 21 HD - Rrokum TV - Rrokum HD - Plus HD - Fox Life - National Geographic - musicAL - Fashion TV - Digi Gold - Albanian Screen - E TV - ON TV - TV Festina - RTL - RTL 2 - N-TV - Al Jazeera - EuroNews - B92 Info - DW TV - Animal Planet HD - Tribuna - First Channel - RTK 1 HD - Top Channel HD - Nickelodeon HD - Fox - Travel Channel - Fine Living - ID Xtra HD - Rai News - Wedding Channel - TVSH - 21 Junior - 21 Popullore - 24 Kitchen - ABC News - Alsat M - Baby TV - Bang Bang - BBC World - Boomerang - CNN int - Cufo TV - Discovery Channel - Discovery Science HD - EuroSport - EXP Histori - EXP Natyra - EXP Shkence - Film Aksion - Film Autor - Film Drame - Film Dy HD - Film Hits - Film Komedi - Film Nje HD - Film Thriller - Hayat TV - Junior TV - Klan Kosova - Kohavision - MTV Live HD - My Music - Nat Geo HD - News 24 - Ora News - Peace TV - Rai 1 - Rai 2 - Rai 3 - Radio Televizioni i Kosoves - Radio Televizioni 21 - TV Dukagjini - Stinet - STV Folk - SuperSonic TV - Top Channel - Top News - TV Arta - Klan TV - Klan TV HD - TV Prizren - \ No newline at end of file diff --git a/sites/ipko.com/ipko.com.config.js b/sites/ipko.com/ipko.com.config.js deleted file mode 100644 index 3d351e3c..00000000 --- a/sites/ipko.com/ipko.com.config.js +++ /dev/null @@ -1,65 +0,0 @@ -const dayjs = require('dayjs') -const utc = require('dayjs/plugin/utc') - -dayjs.extend(utc) - -module.exports = { - site: 'ipko.com', - days: 2, - url: function ({ date }) { - return `https://www.ipko.com/epg/admin/programs.php?date=${date.format('YYYY-MM-DD')}` - }, - parser: function ({ content, channel, date }) { - let programs = [] - const items = parseItems(content, channel) - items.forEach(item => { - const start = parseStart(item, date) - const stop = start.add(item.duration / 3, 'm') - - programs.push({ - title: item.program_name, - description: item.description, - category: item.category, - start: start.toString(), - stop: stop.toString() - }) - }) - - return programs - }, - async channels() { - const axios = require('axios') - - const data = await axios - .get(`https://www.ipko.com/epg/admin/channels.php`) - .then(r => r.data) - .catch(console.log) - - let channels = [] - data.element.forEach(item => { - channels.push({ - lang: 'sq', - site_id: item.channel_id, - name: item.channel_name - }) - }) - - return channels - } -} - -function parseStart(item, date) { - const time = `${date.format('YYYY-MM-DD')} ${item.date}` - - return dayjs.utc(time, 'YYYY-MM-DD HH:mm:ss') -} - -function parseItems(content, channel) { - const data = JSON.parse(content) - const arr = Object.values(data.element) - const items = arr.find(el => { - return el[0] && el[0].channel_id == channel.site_id - }) - - return Array.isArray(items) ? items : [] -} diff --git a/sites/ipko.com/ipko.com.test.js b/sites/ipko.com/ipko.com.test.js deleted file mode 100644 index f1eb5fbc..00000000 --- a/sites/ipko.com/ipko.com.test.js +++ /dev/null @@ -1,38 +0,0 @@ -const { parser, url } = require('./ipko.com.config.js') -const dayjs = require('dayjs') -const utc = require('dayjs/plugin/utc') -const customParseFormat = require('dayjs/plugin/customParseFormat') -dayjs.extend(customParseFormat) -dayjs.extend(utc) - -const date = dayjs.utc('2021-10-24', 'YYYY-MM-DD').startOf('d') -const channel = { - site_id: '406', - xmltv_id: 'RTK1.xk' -} -const content = - '{"element":{"1":[{"id":6367,"channel_id":406,"program_name":"Beautiful People 13","name_short":"","description":"Lin largohet nga Nju Meksiko për t\'u vendosur në Nju Jork e për t\'ia nisur nga fillimi: një punë të re, shtëpi të re dhe njohje të reja. Bashkë me të janë vajzat e saj, Sofia, një 16 vjeçare që shkëlqen në shkollë, dhe Kareni, 20 vjeçare, që do të bë","category":"Sezoni I","duration":150,"day":"Sun","left_distanc":165,"date":"00:55:00"}]}}' - -it('can generate valid url', () => { - const result = url({ date }) - expect(result).toBe('https://www.ipko.com/epg/admin/programs.php?date=2021-10-24') -}) - -it('can parse response', () => { - const result = parser({ date, channel, content }) - expect(result).toMatchObject([ - { - start: 'Sun, 24 Oct 2021 00:55:00 GMT', - stop: 'Sun, 24 Oct 2021 01:45:00 GMT', - title: 'Beautiful People 13', - description: - "Lin largohet nga Nju Meksiko për t'u vendosur në Nju Jork e për t'ia nisur nga fillimi: një punë të re, shtëpi të re dhe njohje të reja. Bashkë me të janë vajzat e saj, Sofia, një 16 vjeçare që shkëlqen në shkollë, dhe Kareni, 20 vjeçare, që do të bë", - category: 'Sezoni I' - } - ]) -}) - -it('can handle empty guide', () => { - const result = parser({ date, channel, content: '{"element":{"1":[{"no":"no"}]}}' }) - expect(result).toMatchObject([]) -}) diff --git a/sites/ipko.com/readme.md b/sites/ipko.com/readme.md deleted file mode 100644 index fa54e122..00000000 --- a/sites/ipko.com/readme.md +++ /dev/null @@ -1,21 +0,0 @@ -# ipko.com - -https://www.ipko.com/epg/ - -### Download the guide - -```sh -npm run grab --- --site=ipko.com -``` - -### Update channel list - -```sh -npm run channels:parse --- --config=./sites/ipko.com/ipko.com.config.js --output=./sites/ipko.com/ipko.com.channels.xml -``` - -### Test - -```sh -npm test --- ipko.com -``` diff --git a/sites/ipko.tv/ipko.tv.channels.xml b/sites/ipko.tv/ipko.tv.channels.xml new file mode 100644 index 00000000..a4f08b4f --- /dev/null +++ b/sites/ipko.tv/ipko.tv.channels.xml @@ -0,0 +1,197 @@ + + + 3 Plus + 21 Junior + 21 Mix + 21 Plus + 21 Popullore + 24 TV + 360 + A2 + A2 CNN + A Haber + ALB UK TV + Al Jazeera + Al Jazeera Balkans + Alsat M + A News + A Para + A Spor + ATD TV + ATV + ATV (Turkey) + Bang Bang + BBF + Beat TV + Bubble + Click TV + Club TV + Çufo + Doku 1 + Doku 2 + Dorcel XXX + Dream Porn + Dream Türk + DTV + Elrodi + Episode + EroXXX + E-TV + Euro D + EuroFilm + Euronews Albania + Euro Star + Explorer Histori + Explorer Shkencë + Fax News + Film Aksion + Film Autor + Film Dramë + Film Family + Film Gold + Film Hits + Film Komedi + Film Max + Film Thriller + First Channel + Folk+ + France 24 + Gurmania + Haber Türk + Halk TV + IPKO Promo + Junior TV + Kanal 7 + Kanal 10 + Kanal D Drama + Kanali 7 + KB Peja + Kids + Kino 1 + Kino 2 + Kino 3 + Klan + Klan Kosova + Klan Macedonia + Klan Music + Klan News + Klan Plus + K-Sport 1 + K-Sport 2 + K-Sport 3 + K-Sport 4 + KTV + Life HD + Living HD + Muse + My Music + ntv + Peace TV + Positive Gold + Power Türk + Premiere 1 + Premiere 2 + Premiere 3 + Premiere 4 + Premium Channel + Prime TV + Prince Kids + PRO1 + RTI + RTK 1 + RTK 2 + RTK 3 + RTK 4 + RTSH 1 + RTSH 3 + RTSH 24 + RTSH Muzikë + RTSH Plus + RTSH Shqip + RTV 21 + RTV 21 MK + RTV Mir + Show Max + Show Türk + Smile + Sofia + Sport 1 + Sport 2 + Sport 3 + Sport 4 + Sport 5 + Sport 6 + Star Channel + Star Life + Star Movies + Star Plus + Stinët + STV Folk + Suite + Supersonic TV + SuperSport 1 + SuperSport 2 + SuperSport 3 + SuperSport 4 + SuperSport 5 + SuperSport 6 + SuperSport 7 + Syri TV + Syri Vision + T7 + Tao Tao + Terra + tëvë 1 + TGRT Belgesel + TGRT EU + TGRT Haber + T + Tip TV + Top Channel + Top News + Travelingo + Tring Action + Tring Classic + Tring Collection + Tring Comedy + Tring Family + Tring Fantasy + Tring History + Tring Kids + Tring Life + Tring Novelas + Tring Originals + Tring Planet + Tring Series + Tring Shqip + Tring Super + Tring Tring + Tring Turkish Stories + Tring World + TRT 1 + TRT Belgesel + TRT Çocuk + TRT Haber + TRT Müzik + TRT Spor + TRT Türk + TRT World + TV 4 + TV5Monde Europe + TV8 Int'l + TV Arta + TV Besa + TV Dukagjini + TV Festina + TV Liria + TV Llapi + TV Mitrovica + TV Most + TV Opinion + TV Puls + TV Slon + TV Tema + Ülke TV + Vizion+ + Zico TV + diff --git a/sites/ipko.tv/ipko.tv.config.js b/sites/ipko.tv/ipko.tv.config.js new file mode 100644 index 00000000..6658ee01 --- /dev/null +++ b/sites/ipko.tv/ipko.tv.config.js @@ -0,0 +1,73 @@ +const axios = require('axios') +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') +const timezone = require('dayjs/plugin/timezone') +const customParseFormat = require('dayjs/plugin/customParseFormat') + +dayjs.extend(utc) +dayjs.extend(timezone) +dayjs.extend(customParseFormat) + +module.exports = { + site: 'ipko.tv', + timezone: 'Europe/Belgrade', + days: 5, + url({ date, channel }) { return 'https://stargate.ipko.tv/api/titan.tv.WebEpg/GetWebEpgData' }, + request: { + method: 'POST', + headers: { + 'Host': 'stargate.ipko.tv', + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0', + 'Accept': 'application/json, text/plain, */*', + 'Accept-Language': 'nl,en-US;q=0.7,en;q=0.3', + 'Content-Type': 'application/json', + 'X-AppLayout': '1', + 'x-language': 'sq', + 'Origin': 'https://ipko.tv', + 'Sec-Fetch-Dest': 'empty', + 'Sec-Fetch-Mode': 'cors', + 'Sec-Fetch-Site': 'cross-site', + 'Sec-GPC': '1', + 'Connection': 'keep-alive' + }, + data({ channel, date }) { + const todayEpoch = date.startOf('day').unix(); + const nextDayEpoch = date.add(1, 'day').startOf('day').unix(); + return JSON.stringify({ + ch_ext_id: channel.site_id, + from: todayEpoch, + to: nextDayEpoch + }) + } + }, + parser: function ({ content }) { + const programs = []; + const data = JSON.parse(content); + data.shows.forEach(show => { + const start = dayjs.unix(show.show_start).utc(); + const stop = dayjs.unix(show.show_end).utc(); + const programData = { + title: show.title, + description: show.summary || 'No description available', + start: start.toISOString(), + stop: stop.toISOString(), + thumbnail: show.thumbnail + } + programs.push(programData) + }) + return programs + }, + async channels() { + const response = await axios.post('https://stargate.ipko.tv/api/titan.tv.WebEpg/ZapList', JSON.stringify({ includeRadioStations: true }), { + headers: this.request.headers + }); + + const data = response.data.data; + return data.map(item => ({ + lang: 'sq', + name: String(item.channel.title), + site_id: String(item.channel.id), + //logo: String(item.channel.logo) + })) + } +} diff --git a/sites/ipko.tv/ipko.tv.test.js b/sites/ipko.tv/ipko.tv.test.js new file mode 100644 index 00000000..2064eeb0 --- /dev/null +++ b/sites/ipko.tv/ipko.tv.test.js @@ -0,0 +1,115 @@ +const { parser, url } = require('./ipko.tv.config.js') +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') +const customParseFormat = require('dayjs/plugin/customParseFormat') +dayjs.extend(customParseFormat) +dayjs.extend(utc) + +const date = dayjs.utc('2024-12-24', 'YYYY-MM-DD').startOf('day') +const channel = { + site_id: 'ipko-promo', + xmltv_id: 'IPKOPROMO' +} + +it('can generate valid url', () => { + expect(url({ date, channel })).toBe('https://stargate.ipko.tv/api/titan.tv.WebEpg/GetWebEpgData') +}) + +it('can parse response', () => { + const content = ` + { + "shows": [ + { + "title": "IPKO Promo", + "show_start": 1735012800, + "show_end": 1735020000, + "timestamp": "5:00 - 7:00", + "show_id": "EPG_TvProfil_IPKOPROMO_296105567", + "thumbnail": "https://vimg.ipko.tv/mtcms/18/2/1/1821cc68-a9bf-4733-b1af-9a5d80163b78.jpg", + "is_adult": false, + "friendly_id": "ipko_promo_4cf3", + "pg": "", + "genres": [], + "year": 0, + "summary": "", + "categories": "Other", + "stb_only": false, + "is_live": false, + "original_title": "IPKO Promo" + }, + { + "title": "IPKO Promo", + "show_start": 1735020000, + "show_end": 1735027200, + "timestamp": "7:00 - 9:00", + "show_id": "EPG_TvProfil_IPKOPROMO_296105568", + "thumbnail": "https://vimg.ipko.tv/mtcms/18/2/1/1821cc68-a9bf-4733-b1af-9a5d80163b78.jpg", + "is_adult": false, + "friendly_id": "ipko_promo_416b", + "pg": "", + "genres": [], + "year": 0, + "summary": "", + "categories": "Other", + "stb_only": false, + "is_live": false, + "original_title": "IPKO Promo" + }, + { + "title": "IPKO Promo", + "show_start": 1735027200, + "show_end": 1735034400, + "timestamp": "9:00 - 11:00", + "show_id": "EPG_TvProfil_IPKOPROMO_296105569", + "thumbnail": "https://vimg.ipko.tv/mtcms/18/2/1/1821cc68-a9bf-4733-b1af-9a5d80163b78.jpg", + "is_adult": false, + "friendly_id": "ipko_promo_2e23", + "pg": "", + "genres": [], + "year": 0, + "summary": "", + "categories": "Other", + "stb_only": false, + "is_live": false, + "original_title": "IPKO Promo" + } + ] + }` + + const result = parser({ content, channel }).map(p => { + p.start = p.start + p.stop = p.stop + return p + }) + + expect(result).toMatchObject([ + { + title: "IPKO Promo", + description: "No description available", + start: "2024-12-24T04:00:00.000Z", + stop: "2024-12-24T06:00:00.000Z", + thumbnail: "https://vimg.ipko.tv/mtcms/18/2/1/1821cc68-a9bf-4733-b1af-9a5d80163b78.jpg" + }, + { + title: "IPKO Promo", + description: "No description available", + start: "2024-12-24T06:00:00.000Z", + stop: "2024-12-24T08:00:00.000Z", + thumbnail: "https://vimg.ipko.tv/mtcms/18/2/1/1821cc68-a9bf-4733-b1af-9a5d80163b78.jpg" + }, + { + title: "IPKO Promo", + description: "No description available", + start: "2024-12-24T08:00:00.000Z", + stop: "2024-12-24T10:00:00.000Z", + thumbnail: "https://vimg.ipko.tv/mtcms/18/2/1/1821cc68-a9bf-4733-b1af-9a5d80163b78.jpg" + } + ]) +}) + +it('can handle empty guide', () => { + const result = parser({ + content: '{"shows":[]}' + }) + expect(result).toMatchObject([]) +}) diff --git a/sites/ipko.tv/readme.md b/sites/ipko.tv/readme.md new file mode 100644 index 00000000..6f2ed259 --- /dev/null +++ b/sites/ipko.tv/readme.md @@ -0,0 +1,15 @@ +# ipko.tv + +https://www.ipko.tv/tv-guide + +### Download the guide + +```sh +npm run grab --- --site=ipko.tv +``` + +### Test + +```sh +npm test --- ipko.tv +```