From ca061163976c8c0b3538eb35d274d99c24465e33 Mon Sep 17 00:00:00 2001 From: Toha Date: Thu, 14 Dec 2023 00:39:55 +0700 Subject: [PATCH 1/2] Update player.ee.co.uk (aka bt.com) guide. Signed-off-by: Toha --- sites/bt.com/bt.com.channels.xml | 168 ------------ sites/bt.com/bt.com.config.js | 54 ---- sites/bt.com/bt.com.test.js | 50 ---- sites/bt.com/readme.md | 15 -- sites/player.ee.co.uk/__data__/data.json | 1 + sites/player.ee.co.uk/__data__/data1.json | 1 + .../player.ee.co.uk.channels.xml | 244 ++++++++++++++++++ .../player.ee.co.uk/player.ee.co.uk.config.js | 102 ++++++++ sites/player.ee.co.uk/player.ee.co.uk.test.js | 72 ++++++ sites/player.ee.co.uk/readme.md | 15 ++ 10 files changed, 435 insertions(+), 287 deletions(-) delete mode 100644 sites/bt.com/bt.com.channels.xml delete mode 100644 sites/bt.com/bt.com.config.js delete mode 100644 sites/bt.com/bt.com.test.js delete mode 100644 sites/bt.com/readme.md create mode 100644 sites/player.ee.co.uk/__data__/data.json create mode 100644 sites/player.ee.co.uk/__data__/data1.json create mode 100644 sites/player.ee.co.uk/player.ee.co.uk.channels.xml create mode 100644 sites/player.ee.co.uk/player.ee.co.uk.config.js create mode 100644 sites/player.ee.co.uk/player.ee.co.uk.test.js create mode 100644 sites/player.ee.co.uk/readme.md diff --git a/sites/bt.com/bt.com.channels.xml b/sites/bt.com/bt.com.channels.xml deleted file mode 100644 index b216fc10..00000000 --- a/sites/bt.com/bt.com.channels.xml +++ /dev/null @@ -1,168 +0,0 @@ - - - Craft Store TV - Ideal Extra - 4seven - 5 Action - 5 Select - 5 Star - 5 USA - Al Jazeera English - BBC Alba - BBC Four - BBC News - BBC One Cambridgeshire - BBC One Channel Islands - BBC One East Midlands - BBC One HD - BBC One London - BBC One North East & Cumbria - BBC One North West - BBC One Oxford - BBC One Scotland - BBC One South - BBC One South East - BBC One South West - BBC One Wales - BBC One West - BBC One West Midlands - BBC One Yorks - BBC Parliament - BBC Scotland - BBC Two England - BBC Two Wales - Blaze UK - Boomerang UK - Cartoonito UK - Cartoon Network UK - CBBC - CBeebies UK - CBS Drama UK - CBS Justice UK - CBS Reality UK - Challenge UK - Channel 4 - Channel 5 - Channel 5 +1 - CITV - Clubland TV - Comedy Central UK - Create and Craft - Dave UK - Dave ja vu - DMAX UK - Drama UK - E4 UK - E4 Extra - E4+1 - Eurosport 1 UK - Eurosport 2 UK - Film 4 UK - Film 4 UK +1 - Food Network UK - GB News - Gems TV - Gold HD - Great! Movies - Great! Movies Action - Great! Movies Action + 1 - Great! Movies Classic - Great! Movies Classic +1 - Great! TV - Great! TV +1 - HGTV UK - Ideal World - ITV - ITV 2 - ITV 2 +1 - ITV 3 - ITV 3 +1 - ITV 4 - ITV 4 +1 - ITV Be - Jewellery Maker - Horror Channel UK - LFC TV - More 4 UK - More4+1 - MTV UK - National Geographic UK - Nickelodeon - Nick Jr UK - NickToons UK - Now 70's - Now 80's - Now 90's - PBS America - Pick UK - Pop - Pop Max - Quest Red UK - Quest Red UK +1 - Quest - Quest UK +1 - QVC UK Beauty - QVC Style UK - QVC UK - Really UK - S4C - Sky Arts HD - Sky Cinema Action HD - Sky Cinema Animation HD - Sky Cinema Comedy HD - Sky Cinema Drama HD - Sky Cinema Family HD - Sky Cinema Greats HD - Sky Cinema Hits HD - Sky Cinema Premiere HD - Sky Cinema Sci-Fi Horror HD - Sky Cinema Select - Sky Cinema Thriller HD - Sky Comedy - Sky Crime - Sky Documentaries - Sky History HD - Sky Max HD - Sky Nature - Sky News HD - Sky Sci-Fi - Sky Showcase HD - Sky Sports Action - Sky Sports Arena - Sky Sports Box Office - Sky Sports Cricket - Sky Sports F1 - Sky Sports Football - Sky Sports Golf - Sky Sports Main Event - Sky Sports Mix - Sky Sports News UK - Sky Sports Premier League - Sky Sports Racing - Sky Witness - Smithsonian Channel UK - STV - STV+1 - Talking Pictures TV - TBN UK - Tiny Pop - TJC - TNT Sports 1 - TNT Sports 10 - TNT Sports 2 - TNT Sports 3 - TNT Sports 4 - TNT Sports 5 - TNT Sports 6 - TNT Sports 7 - TNT Sports 8 - TNT Sports 9 - TNT Sports Box Office UK - TNT Sports Box Office 2 UK - TNT Sports Ultimate - Together TV - Viaplay Xtra - Xpanded TV - Yesterday - Yesterday+1 - diff --git a/sites/bt.com/bt.com.config.js b/sites/bt.com/bt.com.config.js deleted file mode 100644 index 2e7f77d1..00000000 --- a/sites/bt.com/bt.com.config.js +++ /dev/null @@ -1,54 +0,0 @@ -const dayjs = require('dayjs') - -module.exports = { - site: 'bt.com', - days: 2, - url: function ({ date, channel }) { - return `https://voila.metabroadcast.com/4/schedules/${ - channel.site_id - }.json?key=b4d2edb68da14dfb9e47b5465e99b1b1&from=${date.utc().format()}&to=${date - .add(1, 'd') - .utc() - .format()}&source=api.youview.tv&annotations=content.description` - }, - parser: function ({ content }) { - const programs = [] - const items = parseItems(content) - items.forEach(item => { - programs.push({ - title: item.item.title, - description: item.item.description, - icon: parseIcon(item), - season: parseSeason(item), - episode: parseEpisode(item), - start: parseStart(item), - stop: parseStop(item) - }) - }) - - return programs - } -} - -function parseItems(content) { - const data = JSON.parse(content) - return data && data.schedule.entries ? data.schedule.entries : [] -} -function parseSeason(item) { - if (item.item.type !== 'episode') return null - return item.item.series_number || null -} -function parseEpisode(item) { - if (item.item.type !== 'episode') return null - return item.item.episode_number || null -} -function parseIcon(item) { - return item.item.image || null -} -function parseStart(item) { - return dayjs(item.broadcast.transmission_time) -} - -function parseStop(item) { - return dayjs(item.broadcast.transmission_end_time) -} diff --git a/sites/bt.com/bt.com.test.js b/sites/bt.com/bt.com.test.js deleted file mode 100644 index ff4bb04e..00000000 --- a/sites/bt.com/bt.com.test.js +++ /dev/null @@ -1,50 +0,0 @@ -const { parser, url } = require('./bt.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('2022-03-20', 'YYYY-MM-DD').startOf('d') -const channel = { - site_id: 'hsxv', - xmltv_id: 'BBCOneHD.uk' -} - -it('can generate valid url', () => { - expect(url({ date, channel })).toBe( - 'https://voila.metabroadcast.com/4/schedules/hsxv.json?key=b4d2edb68da14dfb9e47b5465e99b1b1&from=2022-03-20T00:00:00Z&to=2022-03-21T00:00:00Z&source=api.youview.tv&annotations=content.description' - ) -}) - -it('can parse response', () => { - const content = - '{"schedule":{"channel":{"title":"BBC One HD","id":"hsxv","uri":"http://api.youview.tv/channels/dvb://233a..4484","images":[{"uri":"https://images.metabroadcast.com?source=http%3A%2F%2Fimages-live.youview.tv%2Fimages%2Fentity%2F8c4c0357-d7ee-5d8a-8bc4-b177b6875128%2Fident%2F1_1024x532.png%3Fdefaultimg%3D0&ETag=r5vyecG6of%2BhCbHeEClx0Q%3D%3D","mime_type":"image/png","type":null,"color":"monochrome","theme":"light_monochrome","aspect_ratio":null,"availability_start":null,"availability_end":null,"width":1024,"height":532,"hasTitleArt":null,"source":null}],"available_from":[{"key":"api.youview.tv","name":"YouView JSON","country":"GB"}],"source":{"key":"api.youview.tv","name":"YouView JSON","country":"GB"},"same_as":[],"media_type":"video","broadcaster":null,"aliases":[{"namespace":"youview:serviceLocator","value":"dvb://233a..4484"},{"namespace":"youview:channel:id","value":"8c4c0357-d7ee-5d8a-8bc4-b177b6875128"}],"genres":[],"high_definition":true,"timeshifted":null,"regional":null,"related_links":[],"start_date":null,"advertised_from":null,"advertised_to":null,"short_description":null,"medium_description":null,"long_description":null,"region":null,"target_regions":[],"channel_type":"CHANNEL","interactive":false,"transmission_types":["DTT"],"quality":"HD","hdr":false},"source":"api.youview.tv","entries":[{"broadcast":{"aliases":[{"namespace":"api.youview.tv:slot","value":"dvb://233a..4484;76bc"},{"namespace":"dvb:event-locator","value":"dvb://233a..4484;76bc"},{"namespace":"dvb:pcrid","value":"crid://fp.bbc.co.uk/b/3Q30S2"},{"namespace":"youview:schedule_event:id","value":"79d318f3-b41a-582d-b089-7b0172538b42"}],"transmission_time":"2022-03-19T23:30:00.000Z","transmission_end_time":"2022-03-20T01:20:00.000Z","broadcast_duration":6600,"broadcast_on":"hsxv","schedule_date":null,"repeat":null,"subtitled":true,"signed":null,"audio_described":false,"high_definition":null,"widescreen":null,"surround":null,"live":null,"premiere":null,"continuation":null,"new_series":null,"new_episode":null,"new_one_off":null,"revised_repeat":null,"blackout_restriction":{"all":false}},"item":{"id":"n72nsw","type":"item","display_title":{"title":"The Finest Hours (2016)","subtitle":null},"year":null,"media_type":"video","specialization":"tv","source":{"key":"api.youview.tv","name":"YouView JSON","country":"GB"},"title":"The Finest Hours (2016)","description":"Drama based on a true story, recounting one of history\'s most daring coastguard rescue attempts. Stranded on a sinking oil tanker along with 30 other sailors, engineer Ray Sybert battles to buy his crew more time as Captain Bernie Webber and three of his colleagues tackle gigantic waves and gale-force winds in their astonishing bid to save the seamen.","image":"https://images.metabroadcast.com?source=http%3A%2F%2Fimages-live.youview.tv%2Fimages%2Fentity%2F52172983%2Fprimary%2F1_1024x576.jpg%3Fdefaultimg%3D0&ETag=z7ucT5kdAq7HuNQf%2FGTEJg%3D%3D","thumbnail":null,"duration":null,"container":null}}]},"terms_and_conditions":{"text":"Specific terms and conditions in your agreement with MetaBroadcast, and with any data provider, apply to your use of this data, and associated systems."},"results":1,"request":{"path":"/4/schedules/hsxv.json","parameters":{"annotations":"content.description","from":"2022-03-20T00:00:00Z","to":"2022-03-21T00:00:00Z","source":"api.youview.tv","key":"b4d2edb68da14dfb9e47b5465e99b1b1"}}}' - - const result = parser({ content }).map(p => { - p.start = p.start.toJSON() - p.stop = p.stop.toJSON() - return p - }) - - expect(result).toMatchObject([ - { - title: 'The Finest Hours (2016)', - description: - "Drama based on a true story, recounting one of history's most daring coastguard rescue attempts. Stranded on a sinking oil tanker along with 30 other sailors, engineer Ray Sybert battles to buy his crew more time as Captain Bernie Webber and three of his colleagues tackle gigantic waves and gale-force winds in their astonishing bid to save the seamen.", - icon: 'https://images.metabroadcast.com?source=http%3A%2F%2Fimages-live.youview.tv%2Fimages%2Fentity%2F52172983%2Fprimary%2F1_1024x576.jpg%3Fdefaultimg%3D0&ETag=z7ucT5kdAq7HuNQf%2FGTEJg%3D%3D', - season: null, - episode: null, - start: '2022-03-19T23:30:00.000Z', - stop: '2022-03-20T01:20:00.000Z' - } - ]) -}) - -it('can handle empty guide', () => { - const result = parser({ - content: - '{"schedule":{"channel":{"title":"BBC One HD","id":"hsxv","uri":"http://api.youview.tv/channels/dvb://233a..4484","images":[{"uri":"https://images.metabroadcast.com?source=http%3A%2F%2Fimages-live.youview.tv%2Fimages%2Fentity%2F8c4c0357-d7ee-5d8a-8bc4-b177b6875128%2Fident%2F1_1024x532.png%3Fdefaultimg%3D0&ETag=r5vyecG6of%2BhCbHeEClx0Q%3D%3D","mime_type":"image/png","type":null,"color":"monochrome","theme":"light_monochrome","aspect_ratio":null,"availability_start":null,"availability_end":null,"width":1024,"height":532,"hasTitleArt":null,"source":null}],"available_from":[{"key":"api.youview.tv","name":"YouView JSON","country":"GB"}],"source":{"key":"api.youview.tv","name":"YouView JSON","country":"GB"},"same_as":[],"media_type":"video","broadcaster":null,"aliases":[{"namespace":"youview:serviceLocator","value":"dvb://233a..4484"},{"namespace":"youview:channel:id","value":"8c4c0357-d7ee-5d8a-8bc4-b177b6875128"}],"genres":[],"high_definition":true,"timeshifted":null,"regional":null,"related_links":[],"start_date":null,"advertised_from":null,"advertised_to":null,"short_description":null,"medium_description":null,"long_description":null,"region":null,"target_regions":[],"channel_type":"CHANNEL","interactive":false,"transmission_types":["DTT"],"quality":"HD","hdr":false},"source":"api.youview.tv","entries":[]},"terms_and_conditions":{"text":"Specific terms and conditions in your agreement with MetaBroadcast, and with any data provider, apply to your use of this data, and associated systems."},"results":1,"request":{"path":"/4/schedules/hsxv.json","parameters":{"annotations":"content.description","from":"2022-03-20T00:00:00Z","to":"2022-03-21T00:00:00Z","source":"api.youview.tv","key":"b4d2edb68da14dfb9e47b5465e99b1b1"}}}' - }) - expect(result).toMatchObject([]) -}) diff --git a/sites/bt.com/readme.md b/sites/bt.com/readme.md deleted file mode 100644 index 99d4d677..00000000 --- a/sites/bt.com/readme.md +++ /dev/null @@ -1,15 +0,0 @@ -# bt.com - -https://www.player.bt.com/#/livetv/schedule - -### Download the guide - -```sh -npm run grab -- --site=bt.com -``` - -### Test - -```sh -npm test -- bt.com -``` diff --git a/sites/player.ee.co.uk/__data__/data.json b/sites/player.ee.co.uk/__data__/data.json new file mode 100644 index 00000000..466334ab --- /dev/null +++ b/sites/player.ee.co.uk/__data__/data.json @@ -0,0 +1 @@ +{"itemType":"ScheduleEvent","size":1,"items":[{"type":"ScheduleEvent","id":"e3def335-5b3a-56f9-ac11-38b6d00a4557","synopsis":"Tamara and her dad help a recent widow who loves to cook for her family design her dream kitchen, perfect for entertaining and large gatherings. S4/Ep1","title":"Bargain Mansions","eventLocator":"dvb://233a..6d60;bed5","publishedDuration":3600,"publishedStartTime":"2023-12-13T13:00:00Z","programmeCrid":"crid://bds.tv/E392928","seriesCrid":"crid://bds.tv/S32803","accessibilityAttributes":{"subtitlesLanguages":["eng"]}}],"type":"Collection"} \ No newline at end of file diff --git a/sites/player.ee.co.uk/__data__/data1.json b/sites/player.ee.co.uk/__data__/data1.json new file mode 100644 index 00000000..95bf43f6 --- /dev/null +++ b/sites/player.ee.co.uk/__data__/data1.json @@ -0,0 +1 @@ +{"itemType":"ScheduleEvent","size":1,"items":[{"type":"ScheduleEvent","id":"845a62f7-4b9a-5530-a1de-93eb54bfe8f6","synopsis":"Tarek and Christina are contacted by a cash strapped flipper who needs to unload a project house. S2/Ep2","title":"Flip Or Flop","eventLocator":"dvb://233a..6d60;bed6","publishedDuration":1800,"publishedStartTime":"2023-12-13T14:00:00Z","programmeCrid":"crid://bds.tv/E313810","seriesCrid":"crid://bds.tv/S30098"}],"type":"Collection"} \ No newline at end of file diff --git a/sites/player.ee.co.uk/player.ee.co.uk.channels.xml b/sites/player.ee.co.uk/player.ee.co.uk.channels.xml new file mode 100644 index 00000000..ef675619 --- /dev/null +++ b/sites/player.ee.co.uk/player.ee.co.uk.channels.xml @@ -0,0 +1,244 @@ + + + On Demand 365 + Mech + + YAAAS! + True Crime + True Crime Xtra + TCC + ADULT smileTV3 + EE TV Preview + Netflix + Prime Video + Sony TV HD + 4seven + 5ACTION + 5Select + 5STAR + 5USA + Alibi + Alibi HD + Al Jazeera Eng + ADULT Babestn + BBC Four + BBC Four HD + BBC News Channel + BBC One London + BBC One London HD + BBC Parliament + BBC RB 1 + BBC Red Button + BBC Three + BBC Three HD + BBC Two England + BBC Two HD + Blaze + Blaze+1 + Boomerang + Boomerang HD + Cartoonito + Cartoon Network + Cartoon Network HD + CBBC + CBBC HD + CBeebies + CBeebies HD + Challenge + Channel 4 + Channel 4 HD + Channel 4 +1 + Channel 5 + Channel 5 HD + Channel 5+1 + Colors Cineplex + Colors HD + Comedy Central + Comedy Central HD + Create & Craft + Dave + Dave Ja Vu + Discovery + Discovery HD + DMAX + Drama + Drama+1 + E4 + E4 Extra + E4+1 + EarthxTV + Eurosport 1 + Eurosport 1 HD + Eurosport 2 + Eurosport 2 HD + Film4 + Film4+1 + Food Network + GB News + Gems TV + GOLD + GOLD HD + GREAT! action + GREAT! Christmas mix + GREAT! movies + GREAT! movies extra + GREAT! Christmas + GREAT! tv + GREAT! tv +1 + HGTV + Hobby Maker + Ideal World + ITV1 HD + ITV1 London + ITV1 +1 London + ITV2 + ITV2 +1 + ITV3 + ITV3 +1 + ITV4 + ITV4 +1 + ITVBe + ITVBe +1 + Jewellery Maker + KetchupTv + Legend + Legend Xtra + More 4 + MTV + MTV HD + NBC News Now + NBC News Now HD + Nickelodeon + Nickelodeon HD + Nick Junior + Nick Junior HD + Nicktoons + PBS America + POP + POP MAX + POP Player + QUEST + QUEST+1 + Quest Red + QVC2 + QVC + Really + Sky Arts + Sky Arts. + Sky Arts HD + Sky Atlantic + Sky Atlantic HD + Sky Cinema Action + Sky Cinema Action HD + Sky Cinema Animation + Sky Cinema Animation HD + Sky Cinema Best of 2023 + Sky Cinema Best of 2023 HD + Sky Cinema Christmas + Sky Cinema Christmas HD + Sky Cinema Comedy + Sky Cinema Comedy HD + Sky Cinema Family + Sky Cinema Family HD + Sky Cinema Favourites + Sky Cinema Favourites HD + Sky Cinema Hits + Sky Cinema Hits HD + Sky Cinema Premiere + Sky Cinema Premiere HD + Sky Cinema Sci-Fi & Horror + Sky Cinema Sci-Fi & Horror HD + Sky Cinema Thriller + Sky Cinema Thriller HD + Sky Comedy + Sky Comedy HD + Sky Crime + Sky Crime HD + Sky Documentaries + Sky Documentaries HD + Sky History + Sky History HD + Sky Kids + Sky Kids HD + Sky Max + Sky Max HD + Sky Mix + Sky Nature + Sky Nature HD + Sky News + Sky News. + Sky News HD + Sky Sci-Fi + Sky Sci-Fi HD + Sky Showcase + Sky Showcase HD + Sky Sports Arena + Sky Sports Arena HD + Sky Sports Box Office HD + Sky Sports Box Office 2 HD + Sky Sports Cricket + Sky Sports Cricket HD + Sky Sports F1 + Sky Sports F1 HD + Sky Sports Football + Sky Sports Football HD + Sky Sports Golf + Sky Sports Golf HD + Sky Sports Main Event + Sky Sports Main Event HD + Sky Sports Mix + Sky Sports Mix HD + Sky Sports News + Sky Sports News HD + Sky Sports NFL + Sky Sports NFL HD + Sky Sports Premier League + Sky Sports Premier League HD + Sky Sports Racing + Sky Sports Racing HD + Sky Witness + Sky Witness HD + Sony Max HD + Talking Pictures TV + TalkTV + TBN UK + That's 60s + That's Christmas + That's 90s + That's TV (UK) + Tiny Pop + TJC + TNT Sports 1 + TNT Sports 1 HD + TNT Sports 2 + TNT Sports 2 HD + TNT Sports 3 + TNT Sports 3 HD + TNT Sports 4 + TNT Sports 4 HD + TNT Sports 5 + TNT Sports 5 HD + TNT Sports 6 + TNT Sports 6 HD + TNT Sports 7 + TNT Sports 7 HD + TNT Sports 8 + TNT Sports 8 HD + TNT Sports 9 + TNT Sports 9 HD + TNT Sports 10 + TNT Sports 10 HD + TNT Sports Box Office 2 HD + TNT Sports Box Office HD + TNT Sports Ultimate + Together TV + Together TV + Utsav Gold HD + Utsav Plus HD + W + WildEarth + ADULT Xpanded TV + Yesterday + Yesterday+1 + Zee Cinema HD + Zee TV HD + diff --git a/sites/player.ee.co.uk/player.ee.co.uk.config.js b/sites/player.ee.co.uk/player.ee.co.uk.config.js new file mode 100644 index 00000000..f8a9411e --- /dev/null +++ b/sites/player.ee.co.uk/player.ee.co.uk.config.js @@ -0,0 +1,102 @@ +const axios = require('axios') +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') + +dayjs.extend(utc) + +module.exports = { + site: 'player.ee.co.uk', + days: 2, + url({ date, channel, hour = 0 }) { + return `https://api.youview.tv/metadata/linear/v2/schedule/by-servicelocator?serviceLocator=${ + encodeURIComponent(channel.site_id) + }&interval=${date.format('YYYY-MM-DD')}T${hour.toString().padStart(2,'0')}Z/PT12H` + }, + request: { + headers: { + Referer: 'https://player.ee.co.uk/' + } + }, + async parser({ content, channel, date }) { + const programs = [] + if (content) { + const schedule = JSON.parse(content) + // fetch next 12 hours schedule + const { url, request } = module.exports + const nextSchedule = await axios + .get(url({ channel, date, hour: 12 }), { headers: request.headers }) + .then(response => response.data) + .catch(console.error) + + if (schedule?.items) { + // merge schedules + if (nextSchedule?.items) { + schedule.items.push(...nextSchedule.items) + } + schedule.items.forEach(item => { + let season, episode + const start = dayjs.utc(item.publishedStartTime) + const stop = start.add(item.publishedDuration, 's') + const description = item.synopsis + if (description) { + const matches = description.trim().match(/\(?S(\d+)[\/\s]Ep(\d+)\)?/) + if (matches) { + if (matches[1]) { + season = parseInt(matches[1]) + } + if (matches[2]) { + episode = parseInt(matches[2]) + } + } + } + programs.push({ + title: item.title, + description, + season, + episode, + start, + stop + }) + }) + } + } + + return programs + }, + async channels() { + const token = + 'eyJkaXNjb3ZlcnlVc2VyR3JvdXBzIjpbIkFMTFVTRVJTIiwiYWxsIiwiaHR0cDovL3JlZmRhd' + + 'GEueW91dmlldy5jb20vbXBlZzdjcy9Zb3VWaWV3QXBwbGljYXRpb25QbGF5ZXJDUy8yMDIxLT' + + 'A5LTEwI2FuZHJvaWRfcnVudGltZS1wcm9maWxlMSIsInRhZzpidC5jb20sMjAxOC0wNy0xMTp' + + '1c2VyZ3JvdXAjR0JSLWJ0X25vd1RWX211bHRpY2FzdCIsInRhZzpidC5jb20sMjAyMS0xMC0y' + + 'NTp1c2VyZ3JvdXAjR0JSLWJ0X2V1cm9zcG9ydCJdLCJyZWdpb25zIjpbIkFMTFJFR0lPTlMiL' + + 'CJHQlIiLCJHQlItRU5HIiwiR0JSLUVORy1sb25kb24iLCJhbGwiXSwic3Vic2V0IjoiMy41Lj' + + 'EvYW5kcm9pZF9ydW50aW1lLXByb2ZpbGUxL0JST0FEQ0FTVF9JUC9HQlItYnRfYnJvYWRiYW5' + + 'kIiwic3Vic2V0cyI6WyIvLy8iLCIvL0JST0FEQ0FTVF9JUC8iLCIzLjUvLy8iXX0=' + const extensions = [ + 'LinearCategoriesExtension', + 'LogicalChannelNumberExtension', + 'BTSubscriptionCodesExtension' + ] + const result = await axios + .get(`https://api.youview.tv/metadata/linear/v2/linear-services`, { + params: { + contentTargetingToken: token, + extensions: extensions.join(',') + }, + headers: module.exports.request.headers + }) + .then(response => response.data) + .catch(console.error) + + return result?.items + .filter(channel => channel.contentTypes.indexOf('tv') >= 0) + .map(channel => { + return { + lang: 'en', + site_id: channel.serviceLocator, + name: channel.fullName + } + }) || [] + } +} diff --git a/sites/player.ee.co.uk/player.ee.co.uk.test.js b/sites/player.ee.co.uk/player.ee.co.uk.test.js new file mode 100644 index 00000000..19c90cda --- /dev/null +++ b/sites/player.ee.co.uk/player.ee.co.uk.test.js @@ -0,0 +1,72 @@ +const { parser, url } = require('./player.ee.co.uk.config.js') +const fs = require('fs') +const path = require('path') +const axios = require('axios') +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') + +dayjs.extend(utc) + +jest.mock('axios') + +const date = dayjs.utc('2023-12-13').startOf('d') +const channel = { + site_id: 'dvb://233a..6d60', + xmltv_id: 'HGTV.uk' +} + +axios.get.mockImplementation((url, opts) => { + if (url === 'https://api.youview.tv/metadata/linear/v2/schedule/by-servicelocator?serviceLocator=dvb%3A%2F%2F233a..6d60&interval=2023-12-13T12Z/PT12H') { + return Promise.resolve({ + data: JSON.parse(fs.readFileSync(path.resolve(__dirname, '__data__/data1.json'))) + }) + } + + return Promise.resolve({ data: '' }) +}) + +it('can generate valid url', () => { + expect(url({ date, channel })).toBe( + 'https://api.youview.tv/metadata/linear/v2/schedule/by-servicelocator?serviceLocator=dvb%3A%2F%2F233a..6d60&interval=2023-12-13T00Z/PT12H' + ) +}) + +it('can parse response', async () => { + const content = fs.readFileSync(path.resolve(__dirname, '__data__/data.json')) + const result = (await parser({ content, channel, date })) + .map(p => { + p.start = p.start.toJSON() + p.stop = p.stop.toJSON() + return p + }) + + expect(result).toMatchObject([ + { + title: 'Bargain Mansions', + description: + 'Tamara and her dad help a recent widow who loves to cook for her family design her dream kitchen, perfect for entertaining and large gatherings. S4/Ep1', + season: 4, + episode: 1, + start: '2023-12-13T13:00:00.000Z', + stop: '2023-12-13T14:00:00.000Z' + }, + { + title: 'Flip Or Flop', + description: + 'Tarek and Christina are contacted by a cash strapped flipper who needs to unload a project house. S2/Ep2', + season: 2, + episode: 2, + start: '2023-12-13T14:00:00.000Z', + stop: '2023-12-13T14:30:00.000Z' + } + ]) +}) + +it('can handle empty guide', async () => { + const result = await parser({ + channel, + date, + content: '' + }) + expect(result).toMatchObject([]) +}) diff --git a/sites/player.ee.co.uk/readme.md b/sites/player.ee.co.uk/readme.md new file mode 100644 index 00000000..155d5ada --- /dev/null +++ b/sites/player.ee.co.uk/readme.md @@ -0,0 +1,15 @@ +# player.ee.co.uk + +https://player.ee.co.uk/#/livetv/schedule + +### Download the guide + +```sh +npm run grab -- --site=player.ee.co.uk +``` + +### Test + +```sh +npm test -- player.ee.co.uk +``` From b55137acd70f8ecf577a25818ba5b86272c2d5da Mon Sep 17 00:00:00 2001 From: Toha Date: Thu, 14 Dec 2023 00:45:09 +0700 Subject: [PATCH 2/2] Site player.ee.co.uk 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..8995e2a9 100644 --- a/SITES.md +++ b/SITES.md @@ -17,7 +17,6 @@ | [bein.com](sites/bein.com) | 🟢 | | | [beinsports.com](sites/beinsports.com) | 🟢 | | | [berrymedia.co.kr](sites/berrymedia.co.kr) | 🟢 | | -| [bt.com](sites/bt.com) | 🔴 | https://github.com/iptv-org/epg/issues/2221 | | [cablego.com.pe](sites/cablego.com.pe) | 🟢 | | | [cableplus.com.uy](sites/cableplus.com.uy) | 🟢 | | | [canalplus-haiti.com](sites/canalplus-haiti.com) | 🔴 | https://github.com/iptv-org/epg/issues/2237 | @@ -101,6 +100,7 @@ | [ontvtonight.com](sites/ontvtonight.com) | 🟢 | | | [osn.com](sites/osn.com) | 🟢 | | | [pbsguam.org](sites/pbsguam.org) | 🟢 | | +| [player.ee.co.uk](sites/player.ee.co.uk) | 🟢 | | | [playtv.unifi.com.my](sites/playtv.unifi.com.my) | 🟢 | | | [plex.tv](sites/plex.tv) | 🟢 | | | [programacion-tv.elpais.com](sites/programacion-tv.elpais.com) | 🟢 | |