From 688df489e47cef49fcd0ed37628f13a00f90d51c Mon Sep 17 00:00:00 2001 From: Toha Date: Wed, 13 Dec 2023 19:55:57 +0700 Subject: [PATCH 1/2] Update pickx.be (aka proximusmwc.be) guide. Signed-off-by: Toha --- sites/pickx.be/__data__/data.json | 1 + sites/pickx.be/pickx.be.config.js | 111 +++++++++ sites/pickx.be/pickx.be.test.js | 54 +++++ sites/pickx.be/pickx.be_de.channels.xml | 11 + sites/pickx.be/pickx.be_en.channels.xml | 23 ++ sites/pickx.be/pickx.be_fr.channels.xml | 196 ++++++++++++++++ sites/pickx.be/pickx.be_nl.channels.xml | 160 +++++++++++++ sites/pickx.be/readme.md | 61 +++++ .../proximusmwc.be.channels.xml | 210 ------------------ sites/proximusmwc.be/proximusmwc.be.config.js | 80 ------- sites/proximusmwc.be/proximusmwc.be.test.js | 66 ------ sites/proximusmwc.be/readme.md | 21 -- 12 files changed, 617 insertions(+), 377 deletions(-) create mode 100644 sites/pickx.be/__data__/data.json create mode 100644 sites/pickx.be/pickx.be.config.js create mode 100644 sites/pickx.be/pickx.be.test.js create mode 100644 sites/pickx.be/pickx.be_de.channels.xml create mode 100644 sites/pickx.be/pickx.be_en.channels.xml create mode 100644 sites/pickx.be/pickx.be_fr.channels.xml create mode 100644 sites/pickx.be/pickx.be_nl.channels.xml create mode 100644 sites/pickx.be/readme.md delete mode 100644 sites/proximusmwc.be/proximusmwc.be.channels.xml delete mode 100644 sites/proximusmwc.be/proximusmwc.be.config.js delete mode 100644 sites/proximusmwc.be/proximusmwc.be.test.js delete mode 100644 sites/proximusmwc.be/readme.md diff --git a/sites/pickx.be/__data__/data.json b/sites/pickx.be/__data__/data.json new file mode 100644 index 00000000..24c5e219 --- /dev/null +++ b/sites/pickx.be/__data__/data.json @@ -0,0 +1 @@ +[{"channelId":"UID0118","duration":20,"programReferenceNumber":"51632189","programScheduleStart":"2023-12-12T23:55:00.000Z","programScheduleEnd":"2023-12-13T00:15:00.000Z","onRewind":false,"scheduleTrailId":202312052657806,"fetchOnRewind":true,"category":"C.News","subCategory":"C.Magazine","program":{"actors":[],"VCHIP":"","blacklist":false,"blacklistInterval":0,"blacklistOTT":false,"blacklistOTTInterval":0,"catchupGracePeriod":0,"category":"C.News","description":"Le journal de vivre ici.","director":"","disableNPVR":false,"episodeNumber":null,"episodeTitle":"","extRatingCodes":"","facebookObjID":"","posterFileName":"250_250_4B990CC58066A7B2A660AFA0BDDE5C41.jpg","programReferenceNumber":"51632189","programType":"NE","releaseYear":null,"seasonNumber":null,"seriesGID":"","seriesID":"","subCategory":"C.Magazine","title":"Le 22h30","trueDuration":20,"supportForVisuallyImpaired":false,"supportForHearingImpaired":true,"translatedCategory":{"fr":"Info","nl":"Nieuws"},"translatedSubCategory":{"fr":"Magazine","nl":"Magazine"}}}] \ No newline at end of file diff --git a/sites/pickx.be/pickx.be.config.js b/sites/pickx.be/pickx.be.config.js new file mode 100644 index 00000000..1b61a64b --- /dev/null +++ b/sites/pickx.be/pickx.be.config.js @@ -0,0 +1,111 @@ +const axios = require('axios') +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') + +dayjs.extend(utc) + +module.exports = { + site: 'pickx.be', + days: 2, + url({ channel, date }) { + return `https://px-epg.azureedge.net/airings/11702375189765v.4.2/${date.format('YYYY-MM-DD')}/channel/${channel.site_id}?timezone=Europe%2FBrussels` + }, + request: { + headers: { + Origin: 'https://www.pickx.be', + Referer: 'https://www.pickx.be/' + } + }, + parser({ channel, content }) { + const programs = [] + if (content) { + const items = JSON.parse(content) + items.forEach(item => { + programs.push({ + title: item.program.title, + sub_title: item.program.episodeTitle, + description: item.program.description, + category: item.program.translatedCategory?.[channel.lang] ? + item.program.translatedCategory[channel.lang] : item.program.category.split('.')[1], + icon: item.program.posterFileName ? + `https://experience-cache.proximustv.be/posterserver/poster/EPG/w-166_h-110/${item.program.posterFileName}` : null, + season: item.program.seasonNumber, + episode: item.program.episodeNumber, + actors: item.program.actors, + director: item.program.director ? [item.program.director] : null, + start: dayjs.utc(item.programScheduleStart), + stop: dayjs.utc(item.programScheduleEnd) + }) + }) + } + + return programs + }, + async channels({ lang = ''}) { + const query = { + operationName: 'getChannels', + variables: { + language: lang, + queryParams: {}, + 'id': '0', + params: { + shouldReadFromCache: true + } + }, + query: + `query getChannels($language: String!, $queryParams: ChannelQueryParams, $id: String, $params: ChannelParams) { + channels(language: $language, queryParams: $queryParams, id: $id, params: $params) { + id + channelReferenceNumber + name + callLetter + number + logo { + key + url + __typename + } + language + hd + radio + replayable + ottReplayable + playable + ottPlayable + recordable + subscribed + cloudRecordable + catchUpWindowInHours + isOttNPVREnabled + ottNPVRStart + subscription { + channelRef + subscribed + upselling { + upsellable + packages + __typename + } + __typename + } + packages + __typename + } + }` + } + const result = await axios + .post('https://api.proximusmwc.be/tiams/v2/graphql', query) + .then(r => r.data) + .catch(console.error) + + return result?.data?.channels + .filter(channel => !channel.radio && (!lang || channel.language === (lang === 'de' ? 'ger' : lang))) + .map(channel => { + return { + lang: channel.language === 'ger' ? 'de' : channel.language, + site_id: channel.id, + name: channel.name + } + }) || [] + } +} \ No newline at end of file diff --git a/sites/pickx.be/pickx.be.test.js b/sites/pickx.be/pickx.be.test.js new file mode 100644 index 00000000..66a4b3a6 --- /dev/null +++ b/sites/pickx.be/pickx.be.test.js @@ -0,0 +1,54 @@ +const { parser, url, request } = require('./pickx.be.config.js') +const fs = require('fs') +const path = require('path') +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') + +dayjs.extend(utc) + +const date = dayjs.utc('2023-12-13').startOf('d') +const channel = { + lang: 'fr', + site_id: 'UID0118', + xmltv_id: 'Vedia.be' +} + +it('can generate valid url', () => { + expect(url({channel, date})) + .toBe('https://px-epg.azureedge.net/airings/11702375189765v.4.2/2023-12-13/channel/UID0118?timezone=Europe%2FBrussels') +}) + +it('can generate valid request headers', () => { + expect(request.headers).toMatchObject({ + Origin: 'https://www.pickx.be', + Referer: 'https://www.pickx.be/' + }) +}) + +it('can parse response', () => { + const content = fs.readFileSync(path.resolve(__dirname, '__data__/data.json')) + const result = parser({ content, channel, date }).map(p => { + p.start = p.start.toJSON() + p.stop = p.stop.toJSON() + return p + }) + + expect(result[0]).toMatchObject({ + start: '2023-12-12T23:55:00.000Z', + stop: '2023-12-13T00:15:00.000Z', + title: 'Le 22h30', + description: + 'Le journal de vivre ici.', + category: 'Info', + icon: 'https://experience-cache.proximustv.be/posterserver/poster/EPG/w-166_h-110/250_250_4B990CC58066A7B2A660AFA0BDDE5C41.jpg' + }) +}) + +it('can handle empty guide', () => { + const result = parser({ + date, + channel, + content: '' + }) + expect(result).toMatchObject([]) +}) diff --git a/sites/pickx.be/pickx.be_de.channels.xml b/sites/pickx.be/pickx.be_de.channels.xml new file mode 100644 index 00000000..6d7f2890 --- /dev/null +++ b/sites/pickx.be/pickx.be_de.channels.xml @@ -0,0 +1,11 @@ + + + BRF TV HD + BRF TV + Das Erste + Das Erste HD + RTL + RTL Deutschland HD + ZDF + ZDF HD + diff --git a/sites/pickx.be/pickx.be_en.channels.xml b/sites/pickx.be/pickx.be_en.channels.xml new file mode 100644 index 00000000..c7112d10 --- /dev/null +++ b/sites/pickx.be/pickx.be_en.channels.xml @@ -0,0 +1,23 @@ + + + Netflix + BBC Ent + BBC First + BBC News HD + BBC News + BBC One HD + BBC One + BBC Two HD + BBC Two + CNN HD + CNN + Euronews E HD + Euronews E + Fashion TV HD + FashionTV + Motorvision+ + Motorvision+ HD + MTV Live HD + Penthouse Gold + W Sports + diff --git a/sites/pickx.be/pickx.be_fr.channels.xml b/sites/pickx.be/pickx.be_fr.channels.xml new file mode 100644 index 00000000..627495fc --- /dev/null +++ b/sites/pickx.be/pickx.be_fr.channels.xml @@ -0,0 +1,196 @@ + + + Disney+ + Studio PXS F + RegInfo F + 13è Rue HD + 13è Rue + AB3 HD + AB3 + ABXPLO HD + ABXPLORE + Action HD + Action + Antenne Centre HD + Antenne C + Animaux HD + Animaux + arte HD + Arte + AUTOMOTO HD + AUTOMOTO + Baby TV F HD + Baby TV F + Be1 + Be Ciné + bel RTL HD + Be Séries + Boom F HD + Boomerang F + Bouké HD + Bouké + bx1 HD + bx1 + C8 + Canal J HD + Canal J + Canal Z HD + Canal Z + Canal Zoom HD + Canal Zoom + Cartoon F HD + Cartoon F + Ciné+Classic + Ciné+Frisson + Ciné+Premier + RTL club + RTL club HD + Comedy Central F + Crime District + Discovery F + Disc HD F + Disn Ch HD F + Disn Ch F + Disn Jr F HD + Disn Jr F + Dobbit TV F + Dorcel XXX HD + Dorcel XXX + E! HD F + E! F + ES1 F + ES1 F HD + ES2 F + ES2 F HD + ES3 F + ES3 F HD + Eleven Pro League 1 (FR) [HD] + Eleven Pro League 1 (FR) + Eleven Pro League 2 (FR) [HD] + Eleven Pro League 2 (FR) + Eleven Pro League 3 (FR) [HD] + Eleven Pro League 3 (FR) + Euronews F + Euronews F HD + Eurosp F + Eurosp HD F + Eurosp2 HD F + Eurosp2 F + France 2 + France 2 HD + France 3 HD + France 3 + France 4 HD + France 4 + France 5 HD + France 5 + France 24 HD + France 24 F + Game One + Gulli HD + Histoire HD + Histoire + KTO + La Trois + La Trois HD + La Une + La Une HD + LCI HD + LCI + LN24 + Mangas HD + Mangas + MaTélé + MaTélé HD + Melody.tv HD + Melody.tv + MezzoLive + MTV F + MTV Hits HD + MTV Hits + Museum TV + MyZen.tv + NGC F + NGC HD F + NGC Wild F + nick F + nick jr F + No Télé HD + No Télé + Paramount Channel + PickxLive F HD + PickxLive F HD + PickxLive F + PickxLive F + Pickx+ F + Pickx+ F HD + Pickx+ F HD + Pickx+ F HD + Pickx+ Sports 1 F HD + Pickx+ Sports 1 F HD + Pickx+ Sports 1 F + Pickx+ Sports 2 F + Pickx+ Sports 2 F HD + Pickx+ Sports 3 F + Pickx+ Sports 3 F HD + Pickx+ Sports 4 F + Pickx+ Sports 4 F HD + Pickx+ Sports 5 F + Pickx+ Sports 5 F HD + Pickx+ Sports 6 F + Pickx+ Sports 6 F HD + Pickx+ Sports 7 F + Pickx+ Sports 7 F HD + Pickx+ Sports 8 F HD + Pickx+ Sports 8 F + Pickx+ Sports 9 F HD + Pickx+ Sports 9 F + Pickx+ Sports 10 F HD + Pickx+ Sports 10 F + Pink HD + Pink + RTL plug HD + RTL plug + ContactV + RFM TV HD + RFM TV + RTC Liège HD + RTC Liège + RTL tvi HD + RTL tvi + Sc et Vie TV HD + Sc et Vie TV + SyFy HD F + SyFy F + TCM Cinéma HD + TCM cinéma + Télé MB HD + Télé MB + Télé Sambre + Télé Sambre HD + TF1 + TF1 HD + TF1 Séries Films + Tiji HD + Tiji + TIPIK HD + TIPIK + TIPIK vision + TMC HD + Trace HD + TraceUrban + TREK HD + TREK + TV5 Monde HD + TV5 Monde + TV Breizh HD + TV Breizh + TV Com + TV Com HD + TV Lux + TV Lux HD + Ushuaïa + Ushuaïa HD + Vedia + Védia HD + diff --git a/sites/pickx.be/pickx.be_nl.channels.xml b/sites/pickx.be/pickx.be_nl.channels.xml new file mode 100644 index 00000000..50dae1fe --- /dev/null +++ b/sites/pickx.be/pickx.be_nl.channels.xml @@ -0,0 +1,160 @@ + + + WTV HD + Studio PXS N + WTV + RegInfo N + Animal Pl HD + Animal Pl + ATV HD + ATV + AVS HD + AVS Gent + Baby TV N HD + Baby TV N + BRUZZ HD + BRUZZ + VRT Canvas + VRT Canvas HD + Cartoonito HD + Cartoonito + Cartoon N HD + Cartoon N + Comedy Central N HD + Comedy Central N + Discovery N + Disc HD N + Disc Sc HD + Disc Science + Disn Ch HD N + Disn Ch N + DisnJr N + Dobbit TV N + Dobbit N HD + Dusk + Eclips + VRT 1 + VRT 1 HD + E! HD N + E! N + ES1 N + ES1 N HD + ES2 N + ES2 N HD + ES3 N + ES3 N HD + Eleven Pro League 1 (NL) [HD] + Eleven Pro League 1 (NL) + Eleven Pro League 2 (NL) [HD] + Eleven Pro League 2 (NL) + Eleven Pro League 3 (NL) [HD] + Eleven Pro League 3 (NL) + Eurosp N + Eurosp HD N + Eurosp2 HD N + Eurosp2 N + Focus TV HD + Focus TV + STAR Channel HD + History HD + History + INPLUS + Inv Disc HD + Inv Disc + Kanaal Z HD + Kanaal Z + Ketnet HD + Ketnet + Ment TV HD + Ment TV + MTV 80s + MTV N HD + MTV N + NGC HD N + NGC N + NGC Wild N + nick N HD + nick N + nick jr N + nick Toons + Njam! HD + Njam! + NPO 1 HD + NPO 1 + NPO 2 HD + NPO 2 + NPO 3 HD + NPO 3 + OUT tv + Passie XXX HD + Passie XXX + PickxLive N HD + PickxLive N HD + PickxLive N + PickxLive N + Pickx+ N + Pickx+ N HD + Pickx+ N HD + Pickx+ N HD + Pickx+ Sports 1 N + Pickx+ Sports 1 N HD + Pickx+ Sports 1 N HD + Pickx+ Sports 2 N + Pickx+ Sports 2 N HD + Pickx+ Sports 3 N + Pickx+ Sports 3 N HD + Pickx+ Sports 4 N + Pickx+ Sports 4 N HD + Pickx+ Sports 5 N + Pickx+ Sports 5 N HD + Pickx+ Sports 6 N + Pickx+ Sports 6 N HD + Pickx+ Sports 7 N + Pickx+ Sports 7 N HD + Pickx+ Sports 8 N HD + Pickx+ Sports 8 N + Pickx+ Sports 9 N HD + Pickx+ Sports 9 N + Pickx+ Sports 10 N HD + Pickx+ Sports 10 N + Plattelands + Play4 HD + Play4 + Play5 HD + Play5 + Play6 + Play6 HD + Play7 HD + Q-Music Kijk Live + Ring TV HD + Ring TV + ROBTV HD + ROB TV + RTV Kempen HD + RTV Kempen O + RTV Mech HD + RTV Mech + Sport 10 + Sport 10 HD + Classica + StuBru + ST100TV HD N + ST100TV N + TLC + TV Limburg HD + TVLimbC + TV Oost HD + TV Oost + Vlaamsparlement.tv + VTM 2 HD + VTM 2 + VTM 3 HD + VTM 3 + VTM 4 HD + VTM 4 + VTM + VTM HD + VTM Gold + VTM NON-STOP DOKTERS HD + VTM NON-STOP DOKTERS + diff --git a/sites/pickx.be/readme.md b/sites/pickx.be/readme.md new file mode 100644 index 00000000..9c9077ef --- /dev/null +++ b/sites/pickx.be/readme.md @@ -0,0 +1,61 @@ +# pickx.be + +https://www.pickx.be/fr/television/programme-tv + +### Download the guide + +Dutch: + +```sh +npm run grab -- --site=pickx.be --lang=nl +``` + +English: + +```sh +npm run grab -- --site=pickx.be --lang=en +``` + +French: + +```sh +npm run grab -- --site=pickx.be --lang=fr +``` + +German: + +```sh +npm run grab -- --site=pickx.be --lang=de +``` + +### Update channel list + +Dutch: + +```sh +npm run channels:parse -- --config=./sites/pickx.be/pickx.be.config.js --output=./sites/pickx.be/pickx.be_nl.channels.xml --set=lang:nl +``` + +English: + +```sh +npm run channels:parse -- --config=./sites/pickx.be/pickx.be.config.js --output=./sites/pickx.be/pickx.be_en.channels.xml --set=lang:en +``` + +French: + +```sh +npm run channels:parse -- --config=./sites/pickx.be/pickx.be.config.js --output=./sites/pickx.be/pickx.be_fr.channels.xml --set=lang:fr +``` + +German: + +```sh +npm run channels:parse -- --config=./sites/pickx.be/pickx.be.config.js --output=./sites/pickx.be/pickx.be_de.channels.xml --set=lang:de +``` + +### Test + +```sh +npm test -- pickx.be +``` diff --git a/sites/proximusmwc.be/proximusmwc.be.channels.xml b/sites/proximusmwc.be/proximusmwc.be.channels.xml deleted file mode 100644 index 905a9c45..00000000 --- a/sites/proximusmwc.be/proximusmwc.be.channels.xml +++ /dev/null @@ -1,210 +0,0 @@ - - - BRF TV HD - Das Erste - RTL - ZDF - BBC Ent - BBC First - BBC One - BBC Two - BBC World - CNN - eSportsONE - Euronews E - Extreme - FashionTV - MVTV - MTV Live HD - Penthouse Gold - TVE Int - 13è Rue HD - 2M Monde - AB3 - ABXPLO HD - Action - Antenne Centre HD - Al Aoula - Al Jazeera - Animaux - Arte - AUTOMOTO - Be1 - Be Ciné - Bel RTL - Be Séries - Boomerang F - Bouké HD - bx1 - C8 - Canal J - Canal Zoom - Cartoon F - Ciné+Classic - Ciné+Frisson - Ciné+Premier - ClubRTL - Comedy Central F - Crime District - Discovery F - Disn Ch HD F - Disn Jr F - Dobbit TV F - Dorcel XXX - E! F - Euronews F - Eurosp F - Eurosp2 F - France 2 - France 24 F - France 3 - France 4 - France 5 - Game One - Gulli HD - Histoire - KTO - La Trois - La Une - LCI - LN24 - Maghreb TV - Mangas - MaTélé - Melody.tv - MezzoLive - MTV F - MTV Hits - Museum TV - MyZen.tv - NGC F - NGC Wild F - nick F - nick jr F - No Télé HD - Paramount Channel - PickxLive F HD - Pickx+ F - Pickx+ Sports 10 F HD - Pickx+ Sports 1 F - Pickx+ Sports 3 F - Pickx+ Sports 4 F - Pickx+ Sports 5 F - Pickx+ Sports 6 F - Pickx+ Sports 7 F - Pickx+ Sports 8 F HD - Pickx+ Sports 9 F HD - Pink - PlugRTL - ContactV - RFM TV - RTC Liège HD - RTL-TVI - Sc et Vie TV - ST100TV F - SyFy F - TCM cinéma - Télé MB HD - Télé Sambre - TF1 - Tiji - TIPIK - TIPIK vision - TMC HD - TraceUrban - TREK - TV5 Monde - TV Breizh - TV Com - TV Lux - Ushuaïa - Vedia - Mediaset - RAI Uno - RAI Due - RAI Tre - Animal Pl - ATV - AVS HD - AVS Gent - Baby TV N - Boomerang N - BRUZZ HD - Canvas - Cartoon N - Comedy Central N - Discovery N - Disc Science - Disn Ch N - DisnJr N - Dobbit TV N - Dusk - Eclips - één - E! N - ES1 N - ES2 N - ES3 N - Eleven Pro League 1 (NL) - Eleven Pro League 2 (NL) - Eleven Pro League 3 (NL) - Eurosp N - Eurosp2 N - Focus TV HD - FOX - History - Insight TV - Inv Disc - Kanaal Z - Ketnet - Ment TV - MTV 80s - MTV N - NGC N - NGC Wild N - nick N - nick jr N - nick Toons - Njam! HD - NPO 1 - NPO 2 - NPO 3 - OUT tv - Passie XXX - Pebble TV - PickxLive N HD - Pickx+ N - Pickx+ Sports 10 N - Pickx+ Sports 1 N - Pickx+ Sports 2 N - Pickx+ Sports 3 N - Pickx+ Sports 4 N - Pickx+ Sports 5 N - Pickx+ Sports 6 N - Pickx+ Sports 7 N - Pickx+ Sports 8 N - Pickx+ Sports 9 N - Plattelands - Play4 - Play5 - Play6 - Play7 HD - Ring TV HD - ROB TV - RTV Kempen HD - RTV Mech HD - Sport 10 - Classica - ST100 Hits - ST100TV N - TLC - TVLimbC - TV Oost - Vlaamsparlement.tv - VTM - VTM 2 - VTM 3 - VTM 4 - VTM Gold - VTM Kids - diff --git a/sites/proximusmwc.be/proximusmwc.be.config.js b/sites/proximusmwc.be/proximusmwc.be.config.js deleted file mode 100644 index c07899ff..00000000 --- a/sites/proximusmwc.be/proximusmwc.be.config.js +++ /dev/null @@ -1,80 +0,0 @@ -const axios = require('axios') -const dayjs = require('dayjs') - -module.exports = { - site: 'proximusmwc.be', - days: 2, - url: 'https://api.proximusmwc.be/v2/graphql', - request: { - headers: { - 'Content-Type': 'application/json' - }, - data({ channel, date }) { - return { - query: - 'query ($language: String!, $startTime: Int!, $endTime: Int!, $options: SchedulesByIntervalOptions) { schedulesByInterval(language: $language, startTime: $startTime, endTime: $endTime, options: $options) { trailId programReferenceNumber channelId title category startTime endTime image { key url __typename } parentalRating detailUrl grouped description shortDescription category categoryId subCategory links { episodeNumber id seasonId seasonName seriesId seriesTitle title type __typename } seriesId __typename }}', - variables: { - startTime: date.unix(), - endTime: date.add(1, 'd').unix(), - language: 'fr', - options: { channelIds: [channel.site_id] } - } - } - } - }, - parser: function ({ content }) { - const programs = [] - const items = parseItems(content) - items.forEach(item => { - programs.push({ - title: item.title, - description: item.description, - icon: parseIcon(item), - category: parseCategory(item), - start: dayjs.unix(item.startTime), - stop: dayjs.unix(item.endTime) - }) - }) - - return programs - }, - async channels() { - const query = { - operationName: 'getPlayableChannels', - variables: { language: 'fr', id: '0' }, - query: - 'query getPlayableChannels($language: String!, $queryParams: ChannelQueryParams, $id: String) { playableChannels(language: $language, queryParams: $queryParams, id: $id) { id name language radio }}' - } - const data = await axios - .post('https://api.proximusmwc.be/v2/graphql', query) - .then(r => r.data) - .catch(console.log) - - const channels = [] - for (let item of data.data.playableChannels) { - if (item.radio) continue - channels.push({ - lang: item.language, - site_id: item.id, - name: item.name - }) - } - - return channels - } -} - -function parseCategory(item) { - return item.category ? item.category.replace(/^C\./, '') : null -} - -function parseIcon(item) { - return item.image[0] ? item.image[0].url : null -} - -function parseItems(content) { - const data = JSON.parse(content) - if (!data || !data.data || !Array.isArray(data.data.schedulesByInterval)) return [] - - return data.data.schedulesByInterval -} diff --git a/sites/proximusmwc.be/proximusmwc.be.test.js b/sites/proximusmwc.be/proximusmwc.be.test.js deleted file mode 100644 index c692bb33..00000000 --- a/sites/proximusmwc.be/proximusmwc.be.test.js +++ /dev/null @@ -1,66 +0,0 @@ -const { parser, url, request } = require('./proximusmwc.be.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('2022-03-04', 'YYYY-MM-DD').startOf('d') -const channel = { - site_id: 'UID0024', - xmltv_id: 'DasErste.de' -} - -it('can generate valid url', () => { - expect(url).toBe('https://api.proximusmwc.be/v2/graphql') -}) - -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({ - query: - 'query ($language: String!, $startTime: Int!, $endTime: Int!, $options: SchedulesByIntervalOptions) { schedulesByInterval(language: $language, startTime: $startTime, endTime: $endTime, options: $options) { trailId programReferenceNumber channelId title category startTime endTime image { key url __typename } parentalRating detailUrl grouped description shortDescription category categoryId subCategory links { episodeNumber id seasonId seasonName seriesId seriesTitle title type __typename } seriesId __typename }}', - variables: { - endTime: 1646438400, - language: 'fr', - options: { channelIds: ['UID0024'] }, - startTime: 1646352000 - } - }) -}) - -it('can parse response', () => { - const content = - '{"data":{"schedulesByInterval":[{"trailId":"UID0024_202202225537","programReferenceNumber":"107504040014","channelId":"UID0024","title":"Der Bozen-Krimi","category":"C.Magazine","startTime":1646350800,"endTime":1646356200,"description":"Chiara Schoras alias \\"Capo\\" Sonja Schwarz muss im 14. Bozen-Krimi nicht nur einen widersprüchlichen Mordfall aufklären, sondern auch ein Geheimnis ans Licht bringen, das zwei Familien auf schmerzhafte Weise untrennbar verbindet.","image":[{"key":"source","url":"https://experience-cache.proximustv.be:443/posterserver/poster/EPG/250_250_BF6BF77FC28F72FA23EAEA6CAAE98B60.jpg","__typename":"Image"},{"key":"custom","url":"https://experience-cache.proximustv.be:443/posterserver/poster/EPG/w-%width%_h-%height%/250_250_BF6BF77FC28F72FA23EAEA6CAAE98B60.jpg","__typename":"Image"}]}]}}' - const result = parser({ content, channel, date }).map(p => { - p.start = p.start.toJSON() - p.stop = p.stop.toJSON() - return p - }) - - expect(result).toMatchObject([ - { - start: '2022-03-03T23:40:00.000Z', - stop: '2022-03-04T01:10:00.000Z', - title: 'Der Bozen-Krimi', - description: - 'Chiara Schoras alias "Capo" Sonja Schwarz muss im 14. Bozen-Krimi nicht nur einen widersprüchlichen Mordfall aufklären, sondern auch ein Geheimnis ans Licht bringen, das zwei Familien auf schmerzhafte Weise untrennbar verbindet.', - category: 'Magazine', - icon: 'https://experience-cache.proximustv.be:443/posterserver/poster/EPG/250_250_BF6BF77FC28F72FA23EAEA6CAAE98B60.jpg' - } - ]) -}) - -it('can handle empty guide', () => { - const result = parser({ - date, - channel, - content: '{"data":{"schedulesByInterval":[]}}' - }) - expect(result).toMatchObject([]) -}) diff --git a/sites/proximusmwc.be/readme.md b/sites/proximusmwc.be/readme.md deleted file mode 100644 index 4fb66f5c..00000000 --- a/sites/proximusmwc.be/readme.md +++ /dev/null @@ -1,21 +0,0 @@ -# proximusmwc.be - -http://proximusmwc.be/ - -### Download the guide - -```sh -npm run grab -- --site=proximusmwc.be -``` - -### Update channel list - -```sh -npm run channels:parse -- --config=./sites/proximusmwc.be/proximusmwc.be.config.js --output=./sites/proximusmwc.be/proximusmwc.be.channels.xml -``` - -### Test - -```sh -npm test -- proximusmwc.be -``` From 2f2a4fcd92cef99a2d2c15a6d433f152272e88ba Mon Sep 17 00:00:00 2001 From: Toha Date: Wed, 13 Dec 2023 19:59:31 +0700 Subject: [PATCH 2/2] Site pickx.be now functional. Signed-off-by: Toha --- SITES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SITES.md b/SITES.md index fb7a10c8..1625f682 100644 --- a/SITES.md +++ b/SITES.md @@ -101,6 +101,7 @@ | [ontvtonight.com](sites/ontvtonight.com) | 🟢 | | | [osn.com](sites/osn.com) | 🟢 | | | [pbsguam.org](sites/pbsguam.org) | 🟢 | | +| [pickx.be](sites/pickx.be) | 🟢 | | | [playtv.unifi.com.my](sites/playtv.unifi.com.my) | 🟢 | | | [plex.tv](sites/plex.tv) | 🟢 | | | [programacion-tv.elpais.com](sites/programacion-tv.elpais.com) | 🟢 | | @@ -110,7 +111,6 @@ | [programme-tv.vini.pf](sites/programme-tv.vini.pf) | 🟢 | | | [programme.tvb.com](sites/programme.tvb.com) | 🔴 | https://github.com/iptv-org/epg/issues/2254 | | [programtv.onet.pl](sites/programtv.onet.pl) | 🟢 | | -| [proximusmwc.be](sites/proximusmwc.be) | 🔴 | https://github.com/iptv-org/epg/issues/2212 | | [raiplay.it](sites/raiplay.it) | 🟢 | | | [reportv.com.ar](sites/reportv.com.ar) | 🟢 | | | [rev.bs](sites/rev.bs) | 🔴 | https://github.com/iptv-org/epg/issues/2255 |