diff --git a/sites/webtv.sk/__data__/content.json b/sites/webtv.sk/__data__/content.json new file mode 100644 index 00000000..817661fd --- /dev/null +++ b/sites/webtv.sk/__data__/content.json @@ -0,0 +1 @@ +{"id":"golf_channel","content":[{"ChannelTitle":"Golf Channel","Start":"2026-02-17T00:00:00+01:00","Stop":"2026-02-17T05:00:00+01:00","Title":"Qatar Masters","Subtitle":"","Description":"Fin\u00e1lov\u00e9 kolo turnaje DP World Tour. Doha, Qatar., (\u0161port)","Icon":"","SeriesID":"dc1ad829a6c42cde31b0f84657eb90bb","Genres":["\u0161port"],"Score":0},{"ChannelTitle":"Golf Channel","Start":"2026-02-17T05:00:00+01:00","Stop":"2026-02-17T07:00:00+01:00","Title":"The Bay vs Los Angeles","Subtitle":"","Description":"Tomorrow's Golf League. SoFi Center, Palm Beach State College, USA., (\u0161port)","Icon":"","SeriesID":"39eb4a8d024da076ce509b24c17e1a75","Genres":["\u0161port"],"Score":0},{"ChannelTitle":"Golf Channel","Start":"2026-02-17T07:00:00+01:00","Stop":"2026-02-17T12:00:00+01:00","Title":"LIV Golf Adelaide","Subtitle":"","Description":"Fin\u00e1lov\u00e9 kolo turnaje LIV Golf. The Grange Golf Club, Australia., (\u0161port)","Icon":"","SeriesID":"735549e083f0cb5495881ee0f2530f16","Genres":["\u0161port"],"Score":0},{"ChannelTitle":"Golf Channel","Start":"2026-02-17T12:00:00+01:00","Stop":"2026-02-17T12:25:00+01:00","Title":"The Golf Fix","Subtitle":"","Description":"Jak kontrolovat d\u00e9lku ran wedgemi. Kontrola vzd\u00e1lenosti je p\u0159edev\u0161\u00edm u ran wedgemi naprosto kl\u00ed\u010dov\u00fd p\u0159edpoklad golfov\u00e9ho \u00fasp\u011bchu. Zn\u00e1m\u00fd tren\u00e9r Devan Bonebrake v\u00e1m v dal\u0161\u00edm d\u00edlu po\u0159adu Golf Fix nab\u00eddne skv\u011bl\u00e9 tipy a cvi\u010den\u00ed pro zlep\u0161en\u00ed v t\u00e9to oblasti.., (\u0161port)","Icon":"\/channel\/golf_channel\/programme\/2026-02-17T12:00:00+01:00\/icon\/8793bfb65b85be90d64adfdb7163c022","SeriesID":"8793bfb65b85be90d64adfdb7163c022","Genres":["\u0161port"],"Score":0},{"ChannelTitle":"Golf Channel","Start":"2026-02-17T12:25:00+01:00","Stop":"2026-02-17T12:30:00+01:00","Title":"Cestov\u00e1n\u00ed za golfem 2025","Subtitle":"","Description":"Profesion\u00e1ln\u00ed turnaje. B\u011bhem deseti d\u00edl\u016f s\u00e9rie Cestov\u00e1n\u00ed za golfem se spole\u010dn\u011b pod\u00edv\u00e1me jak na m\u00edsta, kam golfist\u00e9 v roce 2025 cestuj\u00ed nej\u010dast\u011bji, tak zav\u00edt\u00e1me do destinac\u00ed, kter\u00e1 si o sv\u00e9 slovo teprve \u0159\u00edkaj\u00ed.., (\u0161port)","Icon":"\/channel\/golf_channel\/programme\/2026-02-17T12:25:00+01:00\/icon\/724f5af276123ee230befad2a27fa7fd","SeriesID":"724f5af276123ee230befad2a27fa7fd","Genres":["\u0161port"],"Score":0},{"ChannelTitle":"Golf Channel","Start":"2026-02-17T12:30:00+01:00","Stop":"2026-02-17T14:30:00+01:00","Title":"The Bay vs Los Angeles","Subtitle":"","Description":"(\u0161port)","Icon":"","SeriesID":"39eb4a8d024da076ce509b24c17e1a75","Genres":["\u0161port"],"Score":0},{"ChannelTitle":"Golf Channel","Start":"2026-02-17T14:30:00+01:00","Stop":"2026-02-17T15:00:00+01:00","Title":"The Golf Fix","Subtitle":"","Description":"Um\u011bn\u00ed kr\u00e1tk\u00e9 hry. Nikdo nem\u00e1 r\u00e1d tr\u00e1pen\u00ed okolo greenu. P\u0159itom dobr\u00e1 kr\u00e1tk\u00e1 hra m\u016f\u017ee v\u00fdrazn\u011b pomoci sn\u00ed\u017eit sk\u00f3re. Pokud m\u00e1te probl\u00e9my s kr\u00e1tkou hrou, \u0159e\u0161en\u00ed nab\u00edz\u00ed v dal\u0161\u00edm d\u00edlu Golf Fix pr\u016fvodce Devan Bonebrake.., (\u0161port)","Icon":"\/channel\/golf_channel\/programme\/2026-02-17T14:30:00+01:00\/icon\/8793bfb65b85be90d64adfdb7163c022","SeriesID":"8793bfb65b85be90d64adfdb7163c022","Genres":["\u0161port"],"Score":0},{"ChannelTitle":"Golf Channel","Start":"2026-02-17T15:00:00+01:00","Stop":"2026-02-17T20:00:00+01:00","Title":"LIV Golf Adelaide","Subtitle":"","Description":"Fin\u00e1lov\u00e9 kolo turnaje LIV Golf. The Grange Golf Club, Australia., (\u0161port)","Icon":"","SeriesID":"735549e083f0cb5495881ee0f2530f16","Genres":["\u0161port"],"Score":0},{"ChannelTitle":"Golf Channel","Start":"2026-02-17T20:00:00+01:00","Stop":"2026-02-17T21:00:00+01:00","Title":"Sn\u011bhul\u00e1k","Subtitle":"","Description":"Romana Pavelkov\u00e1, (\u0161port)","Icon":"\/channel\/golf_channel\/programme\/2026-02-17T20:00:00+01:00\/icon\/782cd01f689e432d695a5c482dcbeee0","SeriesID":"782cd01f689e432d695a5c482dcbeee0","Genres":["\u0161port"],"Score":0},{"ChannelTitle":"Golf Channel","Start":"2026-02-17T21:00:00+01:00","Stop":"2026-02-17T21:30:00+01:00","Title":"The Golf Fix","Subtitle":"","Description":"Jak potopit v\u00edc putt\u016f. M\u00edjet kr\u00e1tk\u00e9 putty m\u016f\u017ee znamenat pro celkov\u00e9 sk\u00f3re pohromu. Devan Bonebrake v\u00e1s v dal\u0161\u00edm pokra\u010dov\u00e1n\u00ed po\u0159adu Golf Fix provede v\u0161emi z\u00e1ludnostmi spojen\u00fdmi s puttov\u00e1n\u00edm.., (\u0161port)","Icon":"\/channel\/golf_channel\/programme\/2026-02-17T21:00:00+01:00\/icon\/8793bfb65b85be90d64adfdb7163c022","SeriesID":"8793bfb65b85be90d64adfdb7163c022","Genres":["\u0161port"],"Score":0},{"ChannelTitle":"Golf Channel","Start":"2026-02-17T21:30:00+01:00","Stop":"2026-02-17T23:30:00+01:00","Title":"The Bay vs Los Angeles","Subtitle":"","Description":"(\u0161port)","Icon":"","SeriesID":"39eb4a8d024da076ce509b24c17e1a75","Genres":["\u0161port"],"Score":0},{"ChannelTitle":"Golf Channel","Start":"2026-02-17T23:30:00+01:00","Stop":"2026-02-18T00:00:00+01:00","Title":"The Golf Fix","Subtitle":"","Description":"Jak v golfu pracovat se spinem. Spin neboli zp\u011btn\u00e1 rotace m\u00ed\u010dku je jedn\u00edm z nejd\u016fle\u017eit\u011bj\u0161\u00edch faktor\u016f v golfu. Jak s n\u00edm pracovat a jak ho m\u00edt pod kontrolou v\u00e1s v dal\u0161\u00edm pokra\u010dov\u00e1n\u00ed po\u0159adu Golf Fix nau\u010d\u00ed Devan Bonebrake.., (\u0161port)","Icon":"\/channel\/golf_channel\/programme\/2026-02-17T23:30:00+01:00\/icon\/8793bfb65b85be90d64adfdb7163c022","SeriesID":"8793bfb65b85be90d64adfdb7163c022","Genres":["\u0161port"],"Score":0}]} \ No newline at end of file diff --git a/sites/webtv.sk/readme.md b/sites/webtv.sk/readme.md new file mode 100644 index 00000000..70cd2425 --- /dev/null +++ b/sites/webtv.sk/readme.md @@ -0,0 +1,21 @@ +# webtv.sk + +https://webtv.sk/archive + +### Download the guide + +```sh +npm run grab --- --site=webtv.sk +``` + +### Update channel list + +```sh +npm run channels:parse --- --config=./sites/webtv.sk/webtv.sk.config.js --output=./sites/webtv.sk/webtv.sk.channels.xml +``` + +### Test + +```sh +npm test --- webtv.sk +``` diff --git a/sites/webtv.sk/webtv.sk.channels.xml b/sites/webtv.sk/webtv.sk.channels.xml new file mode 100644 index 00000000..05882254 --- /dev/null +++ b/sites/webtv.sk/webtv.sk.channels.xml @@ -0,0 +1,189 @@ + + + 360 TuneBox + Al Jazeera + Al Jazeera English + AMC + Animal Planet + Arena Sport 1 + Arena Sport 2 + Arirang TV + Armenia 1 TV + ATV Žiar + Auto Motor und Sport + AXN + AXN Black + AXN White + Barrandov + Barrandov Krimi + BTV + CETV + CGTN + CGTN Documentary + Cinemax + Cinemax 2 + HaHa TV + Crime & Investigation + ČSRTV + ČT1 + ČT2 + ČT24 + ČT :D - ČT art + Current Time + DajTo + Discovery + Disney Channel + Disney Junior + DocuBox + Doktor TV + Doma + Duck TV + Duck TV Plus + eClutch 1 + eClutch 2 + English Club TV + Espreso TV + Euronews + Eurosport 1 + Eurosport 2 + Fashion TV Czech & Slovak + FashionBox + Fast and Funbox + FightBox + Film + + FilmBox + Filmbox Arthouse + FilmBox Extra + FilmBox Family + FilmBox Stars + FilmBox Premium + Fishing&Hunting + Folklorika + Food Network + France 24 + France 24 English + Golf Channel + GTTV + HBO + HBO 2 + HBO 3 + HGTV + History 2 + History Channel + HN TV + Antik Info TV + ID + JimJam + JOJ + JOJ 24 + JOJ Cinema + JOJ Cinema +1 + JOJ Plus + JOJ +1 + JOJ Šport + JOJ Šport 2 + JOJ Svet + Kino Barrandov + Kitchen TV + LALA TV + LangLab + Life TV + Lingo Toons + TV LocAll + Love Nature + TV LUX + Markíza + Markíza Klasik + Markíza Krimi + Markíza +1 + Mestská Televízia Trnava + Mestská Tv Košice + Mestská Televízia Partizánske + Miestna TV Trebišov + Minimax + TV Mistral + Moldava TV + National Geographic Channel + National Geographic Wild + NHK World Japan + Nick Jr + Nickelodeon + Nicktoons + NOE + Nova International + Nova Sport 1 + Nova Sport 2 + tv NRSR + Óčko + Óčko Black + Óčko Expres + Óčko Star + Padel Time + PARK TV + Rebel + Relax + Polar TV + Prima Cool SK + Prima Krimi SK + Prima Love SK + CNN Prima News + Prima SK + Rai Tre + Rai Uno + Régió TV + A11 + Retro Music Television + RiK TV + Jojko + RVTV + Senzi + Seznam.cz TV + Skvelé TV + Sky News + PREMIUM + Šláger Muzika + Šláger Originál + Spektrum + Spektrum Home + Sport 1 + Sport 2 + STINGRAY iConcerts + Jednotka + Dvojka + :24 + :Šport + SuperYacht TV + TA3 + Tanečné súťaže + TLC + Travel Channel + TRT World + Turbo TV + TV7 + TV 9 + TV8 + TV Bratislava + TV Nitrička + TV Nové Zámky + TV Panoráma + TV Paprika + TV Piánko + TV Poprad + TV Považie + TV RAJ + TV Reduta + TV Romana + TV Ružinov + TV SEN + TV Kežmarok + Tv Vega + Godzone TV + TV Zemplín + TVP Info + TVP Polonia + TVP World + UA TV + Kanal1 + WAU + Televízia Slovensko + diff --git a/sites/webtv.sk/webtv.sk.config.js b/sites/webtv.sk/webtv.sk.config.js new file mode 100644 index 00000000..dc7045a2 --- /dev/null +++ b/sites/webtv.sk/webtv.sk.config.js @@ -0,0 +1,74 @@ +const axios = require('axios') +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') + +dayjs.extend(utc) + +module.exports = { + site: 'webtv.sk', + days: 2, + delay: 1000, + url: 'https://api.webtv.sk/epg/channel', + request: { + method: 'POST', + headers: { + 'content-type': 'application/json' + }, + data({ channel, date }) { + return { + channel_id: channel.site_id, + date: dayjs.utc(date).toJSON() + } + } + }, + parser({ content }) { + return parseItems(content).map(item => { + return { + title: item.Title, + subtitle: item.Subtitle, + description: item.Description, + categories: item.Genres, + start: dayjs(item.Start), + stop: dayjs(item.Stop) + } + }) + }, + async channels() { + const data = await axios + .post( + 'https://api.webtv.sk/channels', + { type: 'TV', channels_content: null }, + { + headers: { + 'content-type': 'application/json' + } + } + ) + .then(r => r.data) + .catch(console.error) + + let channels = [] + for (const site_id in data.data) { + const channel = data.data[site_id] + + channels.push({ + site_id, + name: channel.name, + lang: 'sk' + }) + } + + return channels + } +} + +function parseItems(content) { + try { + const data = JSON.parse(content) + if (!data || !Array.isArray(data.content)) return [] + + return data.content + } catch { + return [] + } +} diff --git a/sites/webtv.sk/webtv.sk.test.js b/sites/webtv.sk/webtv.sk.test.js new file mode 100644 index 00000000..b3b42d56 --- /dev/null +++ b/sites/webtv.sk/webtv.sk.test.js @@ -0,0 +1,68 @@ +const { parser, url, request } = require('./webtv.sk.config.js') +const fs = require('fs') +const path = require('path') +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('2026-02-17', 'YYYY-MM-DD').startOf('d') +const channel = { site_id: 'golf_channel' } + +it('can generate valid url', () => { + expect(url).toBe('https://api.webtv.sk/epg/channel') +}) + +it('can generate valid request method', () => { + expect(request.method).toBe('POST') +}) + +it('can generate valid request headers', () => { + expect(request.headers).toMatchObject({ + 'content-type': 'application/json' + }) +}) + +it('can generate valid request data', () => { + expect(request.data({ channel, date })).toMatchObject({ + channel_id: 'golf_channel', + date: '2026-02-17T00:00:00.000Z' + }) +}) + +it('can parse response', () => { + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json')) + + const results = parser({ content }).map(p => { + p.start = p.start.toJSON() + p.stop = p.stop.toJSON() + + return p + }) + + expect(results.length).toBe(12) + expect(results[0]).toMatchObject({ + title: 'Qatar Masters', + subtitle: '', + description: 'Finálové kolo turnaje DP World Tour. Doha, Qatar., (šport)', + categories: ['šport'], + start: '2026-02-16T23:00:00.000Z', + stop: '2026-02-17T04:00:00.000Z' + }) + expect(results[11]).toMatchObject({ + title: 'The Golf Fix', + subtitle: '', + description: + 'Jak v golfu pracovat se spinem. Spin neboli zpětná rotace míčku je jedním z nejdůležitějších faktorů v golfu. Jak s ním pracovat a jak ho mít pod kontrolou vás v dalším pokračování pořadu Golf Fix naučí Devan Bonebrake.., (šport)', + categories: ['šport'], + start: '2026-02-17T22:30:00.000Z', + stop: '2026-02-17T23:00:00.000Z' + }) +}) + +it('can handle empty guide', () => { + const results = parser({ content: '' }) + + expect(results).toMatchObject([]) +})