From 56a49a876c57dd33d4b465c389e5fd72a3cb0bb4 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Tue, 21 Nov 2023 11:37:48 +0300 Subject: [PATCH] Rename magentatv.at to tv.magenta.at --- sites/magentatv.at/magentatv.at.channels.xml | 310 ------------------ .../__data__/content_0000.json | 0 .../__data__/content_0300.json | 0 .../__data__/content_0600.json | 0 .../__data__/content_0900.json | 0 .../__data__/content_1200.json | 0 .../__data__/content_1500.json | 0 .../__data__/content_1800.json | 0 .../__data__/content_2100.json | 0 .../__data__/program.json | 0 .../tv.magenta.at/tv.magenta.at.channels.xml | 310 ++++++++++++++++++ .../tv.magenta.at.config.js} | 32 +- .../tv.magenta.at.test.js} | 48 ++- 13 files changed, 364 insertions(+), 336 deletions(-) delete mode 100644 sites/magentatv.at/magentatv.at.channels.xml rename sites/{magentatv.at => tv.magenta.at}/__data__/content_0000.json (100%) rename sites/{magentatv.at => tv.magenta.at}/__data__/content_0300.json (100%) rename sites/{magentatv.at => tv.magenta.at}/__data__/content_0600.json (100%) rename sites/{magentatv.at => tv.magenta.at}/__data__/content_0900.json (100%) rename sites/{magentatv.at => tv.magenta.at}/__data__/content_1200.json (100%) rename sites/{magentatv.at => tv.magenta.at}/__data__/content_1500.json (100%) rename sites/{magentatv.at => tv.magenta.at}/__data__/content_1800.json (100%) rename sites/{magentatv.at => tv.magenta.at}/__data__/content_2100.json (100%) rename sites/{magentatv.at => tv.magenta.at}/__data__/program.json (100%) create mode 100644 sites/tv.magenta.at/tv.magenta.at.channels.xml rename sites/{magentatv.at/magentatv.at.config.js => tv.magenta.at/tv.magenta.at.config.js} (75%) rename sites/{magentatv.at/magentatv.at.test.js => tv.magenta.at/tv.magenta.at.test.js} (62%) diff --git a/sites/magentatv.at/magentatv.at.channels.xml b/sites/magentatv.at/magentatv.at.channels.xml deleted file mode 100644 index d6964b50..00000000 --- a/sites/magentatv.at/magentatv.at.channels.xml +++ /dev/null @@ -1,310 +0,0 @@ - - - - 123.tv - 13TH STREET HD - 3sat HD - Al Jazeera - ARCADIA World HD - ARD alpha HD - arte HD - ATV2 HD - ATV HD - auto motor und sport channel HD - auto motor und sport channel UHD - BBC Entertainment - BBC News HD - Bergblick - Bibel TV HD - Bloomberg TV - Bongusto HD - BR Fernsehen HD - Cartoonito - Cartoon Network HD - CCTV4 - CGTN - Club MTV - CNBC - CNN International - Comedy Central - Comedy Central HD - Crime + Investigation - Crime + Investigation HD - Curiosity Channel - Das Erste HD - Deluxe Music HD - Disney Channel - DMAX - DMAX HD - Dubai TV - Duna TV - eSports1 HD - euronews HD - Eurosport 1 - Eurosport 1 Srbija - Eurosport Türkiye - Eurosport 1 HD - eXXpressTV - Fashion-TV HD - Film Klub - Fix & Foxi - France 24 HD - GEO Television HD - Gute Laune TV - Habertürk TV - Hayat - Heimatkanal - Home & Garden TV - History HD - Hitradio Ö3 - hr-fernsehen HD - HRT TV1 HD - HSE Extra HD - HSE HD - HSE Trend - K19 - Kabel Eins - kabel eins CLASSICS HD - Kabel Eins Doku - Kabel Eins Doku HD - KiKA HD - Kinowelt TV HD - Klasik TV - krone.tv - krone.tv HD - KT 1 - Kurier TV - Ländle TV HD - Magenta HD - MDR Fernsehen HD - Melodie TV - Motorvision+ HD - MTV 00s - MTV 80s - MTV 90s - MTV HD - MTVhits! - MTV live HD - N24 doku - Nat Geo HD - Nat Geo Wild HD - NDR Fernsehen HD - Nickelodeon - Nitro - Nitro HD - n-tv - n-tv HD - oe24.TV - oe24.TV HD - Okto HD - One HD - ORF 1 HD - ORF 2 Burgenland HD - ORF 2 EUROPE - ORF 2 Kärnten HD - ORF 2 Nö HD - ORF 2 Oberösterreich HD - ORF 2 Salzburg HD - ORF 2 Steiermark HD - ORF 2 Tirol HD - ORF 2 Vorarlberg HD - ORF 2 Wien HD - ORF III HD - ORF Sport+ HD - phoenix HD - Pink Extra - Pink Film - Pink Music - Pink Plus - ProSieben - ProSieben FUN HD - ProSieben Maxx - ProSieben Maxx HD - PULS 4 - PULS24 HD - PULS 4 HD - QVC HD - QVC Style - R9 HD - rbb HD - RiC - Romance TV HD - RTL - RTL Crime HD - RTL HD - RTL Living HD - RTL Passion HD - Super RTL - RTLup - RTLup HD - RTLZWEI - RTLZWEI HD - RTS Svet HD - SAT.1 - SAT.1 emotions HD - Sat.1 Gold - SAT.1 Gold HD - SAT.1 HD - Servus TV - Servus TV HD - sixx austria - sixx austria HD - Sky Atlantic HD - Sky Cinema Action HD - Sky Cinema Best of HD - Sky Cinema Classics HD - Sky Cinema Fun HD - Sky Cinema Premieren HD - Sky Cinema Premieren +24 HD - Sky Cinema Thriller HD - Sky Crime HD - Sky Documentaries HD - Sky Krimi HD - Sky Nature HD - Sky One HD - Sky Replay HD - Sky Showcase HD - Sky Sport HD 10 - Sky Sport HD 1 - Sky Sport HD 2 - Sky Sport HD 3 - Sky Sport HD 4 - Sky Sport HD 5 - Sky Sport HD 6 - Sky Sport HD 7 - Sky Sport HD 8 - Sky Sport HD 9 - Sky Sport Austria 1 HD - Sky Sport Austria 2 HD - Sky Sport Austria 3 HD - Sky Sport Austria 4 HD - Sky Sport Austria 5 HD - Sky Sport Austria 6 HD - Sky Sport Austria 7 HD - Sky Bundesliga HD 10 - Sky Bundesliga HD 1 - Sky Bundesliga HD 2 - Sky Bundesliga HD 3 - Sky Bundesliga HD 4 - Sky Bundesliga HD 5 - Sky Bundesliga HD 6 - Sky Bundesliga HD 7 - Sky Bundesliga HD 8 - Sky Bundesliga HD 9 - Sky Bundesliga HD - Sky Sport F1 - Sky Sport Golf HD - Sky Sport Mix HD - Sky Sport News HD - Sky Sport Premier League HD - Sky Sport Tennis HD - Spiegel Geschichte HD - Sport 1 - Sport 1 HD - Sport1+ HD - SPORTDIGITAL FUSSBALL HD - SRF info HD - Stingray Classica HD - Streamster.tv - Super RTL HD - Syfy HD - tagesschau24 HD - TELE 5 - Tirol TV HD - TLC - TLC HD - Toxic TV HD - TRT World - TV5Monde Europe - MNE - TV Polonia - Universal TV HD - VESTI - VOX - VOX HD - W24 - W24 HD - Warner TV Comedy HD - Warner TV Serie HD - WDR Fernsehen HD - WNTV HD - ZDF HD - ZDFinfo HD - ZDFneo HD - diff --git a/sites/magentatv.at/__data__/content_0000.json b/sites/tv.magenta.at/__data__/content_0000.json similarity index 100% rename from sites/magentatv.at/__data__/content_0000.json rename to sites/tv.magenta.at/__data__/content_0000.json diff --git a/sites/magentatv.at/__data__/content_0300.json b/sites/tv.magenta.at/__data__/content_0300.json similarity index 100% rename from sites/magentatv.at/__data__/content_0300.json rename to sites/tv.magenta.at/__data__/content_0300.json diff --git a/sites/magentatv.at/__data__/content_0600.json b/sites/tv.magenta.at/__data__/content_0600.json similarity index 100% rename from sites/magentatv.at/__data__/content_0600.json rename to sites/tv.magenta.at/__data__/content_0600.json diff --git a/sites/magentatv.at/__data__/content_0900.json b/sites/tv.magenta.at/__data__/content_0900.json similarity index 100% rename from sites/magentatv.at/__data__/content_0900.json rename to sites/tv.magenta.at/__data__/content_0900.json diff --git a/sites/magentatv.at/__data__/content_1200.json b/sites/tv.magenta.at/__data__/content_1200.json similarity index 100% rename from sites/magentatv.at/__data__/content_1200.json rename to sites/tv.magenta.at/__data__/content_1200.json diff --git a/sites/magentatv.at/__data__/content_1500.json b/sites/tv.magenta.at/__data__/content_1500.json similarity index 100% rename from sites/magentatv.at/__data__/content_1500.json rename to sites/tv.magenta.at/__data__/content_1500.json diff --git a/sites/magentatv.at/__data__/content_1800.json b/sites/tv.magenta.at/__data__/content_1800.json similarity index 100% rename from sites/magentatv.at/__data__/content_1800.json rename to sites/tv.magenta.at/__data__/content_1800.json diff --git a/sites/magentatv.at/__data__/content_2100.json b/sites/tv.magenta.at/__data__/content_2100.json similarity index 100% rename from sites/magentatv.at/__data__/content_2100.json rename to sites/tv.magenta.at/__data__/content_2100.json diff --git a/sites/magentatv.at/__data__/program.json b/sites/tv.magenta.at/__data__/program.json similarity index 100% rename from sites/magentatv.at/__data__/program.json rename to sites/tv.magenta.at/__data__/program.json diff --git a/sites/tv.magenta.at/tv.magenta.at.channels.xml b/sites/tv.magenta.at/tv.magenta.at.channels.xml new file mode 100644 index 00000000..65a6e83e --- /dev/null +++ b/sites/tv.magenta.at/tv.magenta.at.channels.xml @@ -0,0 +1,310 @@ + + + + 123.tv + 13TH STREET HD + 3sat HD + Al Jazeera + ARCADIA World HD + ARD alpha HD + arte HD + ATV2 HD + ATV HD + auto motor und sport channel HD + auto motor und sport channel UHD + BBC Entertainment + BBC News HD + Bergblick + Bibel TV HD + Bloomberg TV + Bongusto HD + BR Fernsehen HD + Cartoonito + Cartoon Network HD + CCTV4 + CGTN + Club MTV + CNBC + CNN International + Comedy Central + Comedy Central HD + Crime + Investigation + Crime + Investigation HD + Curiosity Channel + Das Erste HD + Deluxe Music HD + Disney Channel + DMAX + DMAX HD + Dubai TV + Duna TV + eSports1 HD + euronews HD + Eurosport 1 + Eurosport 1 Srbija + Eurosport Türkiye + Eurosport 1 HD + eXXpressTV + Fashion-TV HD + Film Klub + Fix & Foxi + France 24 HD + GEO Television HD + Gute Laune TV + Habertürk TV + Hayat + Heimatkanal + Home & Garden TV + History HD + Hitradio Ö3 + hr-fernsehen HD + HRT TV1 HD + HSE Extra HD + HSE HD + HSE Trend + K19 + Kabel Eins + kabel eins CLASSICS HD + Kabel Eins Doku + Kabel Eins Doku HD + KiKA HD + Kinowelt TV HD + Klasik TV + krone.tv + krone.tv HD + KT 1 + Kurier TV + Ländle TV HD + Magenta HD + MDR Fernsehen HD + Melodie TV + Motorvision+ HD + MTV 00s + MTV 80s + MTV 90s + MTV HD + MTVhits! + MTV live HD + N24 doku + Nat Geo HD + Nat Geo Wild HD + NDR Fernsehen HD + Nickelodeon + Nitro + Nitro HD + n-tv + n-tv HD + oe24.TV + oe24.TV HD + Okto HD + One HD + ORF 1 HD + ORF 2 Burgenland HD + ORF 2 EUROPE + ORF 2 Kärnten HD + ORF 2 Nö HD + ORF 2 Oberösterreich HD + ORF 2 Salzburg HD + ORF 2 Steiermark HD + ORF 2 Tirol HD + ORF 2 Vorarlberg HD + ORF 2 Wien HD + ORF III HD + ORF Sport+ HD + phoenix HD + Pink Extra + Pink Film + Pink Music + Pink Plus + ProSieben + ProSieben FUN HD + ProSieben Maxx + ProSieben Maxx HD + PULS 4 + PULS24 HD + PULS 4 HD + QVC HD + QVC Style + R9 HD + rbb HD + RiC + Romance TV HD + RTL + RTL Crime HD + RTL HD + RTL Living HD + RTL Passion HD + Super RTL + RTLup + RTLup HD + RTLZWEI + RTLZWEI HD + RTS Svet HD + SAT.1 + SAT.1 emotions HD + Sat.1 Gold + SAT.1 Gold HD + SAT.1 HD + Servus TV + Servus TV HD + sixx austria + sixx austria HD + Sky Atlantic HD + Sky Cinema Action HD + Sky Cinema Best of HD + Sky Cinema Classics HD + Sky Cinema Fun HD + Sky Cinema Premieren HD + Sky Cinema Premieren +24 HD + Sky Cinema Thriller HD + Sky Crime HD + Sky Documentaries HD + Sky Krimi HD + Sky Nature HD + Sky One HD + Sky Replay HD + Sky Showcase HD + Sky Sport HD 10 + Sky Sport HD 1 + Sky Sport HD 2 + Sky Sport HD 3 + Sky Sport HD 4 + Sky Sport HD 5 + Sky Sport HD 6 + Sky Sport HD 7 + Sky Sport HD 8 + Sky Sport HD 9 + Sky Sport Austria 1 HD + Sky Sport Austria 2 HD + Sky Sport Austria 3 HD + Sky Sport Austria 4 HD + Sky Sport Austria 5 HD + Sky Sport Austria 6 HD + Sky Sport Austria 7 HD + Sky Bundesliga HD 10 + Sky Bundesliga HD 1 + Sky Bundesliga HD 2 + Sky Bundesliga HD 3 + Sky Bundesliga HD 4 + Sky Bundesliga HD 5 + Sky Bundesliga HD 6 + Sky Bundesliga HD 7 + Sky Bundesliga HD 8 + Sky Bundesliga HD 9 + Sky Bundesliga HD + Sky Sport F1 + Sky Sport Golf HD + Sky Sport Mix HD + Sky Sport News HD + Sky Sport Premier League HD + Sky Sport Tennis HD + Spiegel Geschichte HD + Sport 1 + Sport 1 HD + Sport1+ HD + SPORTDIGITAL FUSSBALL HD + SRF info HD + Stingray Classica HD + Streamster.tv + Super RTL HD + Syfy HD + tagesschau24 HD + TELE 5 + Tirol TV HD + TLC + TLC HD + Toxic TV HD + TRT World + TV5Monde Europe + MNE + TV Polonia + Universal TV HD + VESTI + VOX + VOX HD + W24 + W24 HD + Warner TV Comedy HD + Warner TV Serie HD + WDR Fernsehen HD + WNTV HD + ZDF HD + ZDFinfo HD + ZDFneo HD + diff --git a/sites/magentatv.at/magentatv.at.config.js b/sites/tv.magenta.at/tv.magenta.at.config.js similarity index 75% rename from sites/magentatv.at/magentatv.at.config.js rename to sites/tv.magenta.at/tv.magenta.at.config.js index 0b5490c1..2b7cae79 100644 --- a/sites/magentatv.at/magentatv.at.config.js +++ b/sites/tv.magenta.at/tv.magenta.at.config.js @@ -6,14 +6,14 @@ const API_ENDPOINT = 'https://tv-at-prod.yo-digital.com/at-bifrost' const headers = { 'Device-Id': crypto.randomUUID(), - 'app_key': 'CTnKA63ruKM0JM1doxAXwwyQLLmQiEiy', - 'app_version': '02.0.830', + app_key: 'CTnKA63ruKM0JM1doxAXwwyQLLmQiEiy', + app_version: '02.0.830', 'X-User-Agent': 'web|web|Firefox-120|02.0.830|1', 'x-request-tracking-id': crypto.randomUUID() } module.exports = { - site: 'magentatv.at', + site: 'tv.magenta.at', days: 2, request: { headers, @@ -22,7 +22,9 @@ module.exports = { } }, url: function ({ channel, date }) { - return `${API_ENDPOINT}/epg/channel/schedules/v2?station_ids=${channel.site_id}&date=${date.format('YYYY-MM-DD')}&hour_offset=${date.format('H')}&hour_range=3&natco_code=at` + return `${API_ENDPOINT}/epg/channel/schedules/v2?station_ids=${ + channel.site_id + }&date=${date.format('YYYY-MM-DD')}&hour_offset=${date.format('H')}&hour_range=3&natco_code=at` }, async parser({ content, channel, date }) { let programs = [] @@ -32,7 +34,13 @@ module.exports = { if (!items.length) return programs const promises = [3, 6, 9, 12, 15, 18, 21].map(i => - axios.get(`${API_ENDPOINT}/epg/channel/schedules/v2?station_ids=${channel.site_id}&date=${date.format('YYYY-MM-DD')}&hour_offset=${i}&hour_range=3&natco_code=at`, {headers})) + axios.get( + `${API_ENDPOINT}/epg/channel/schedules/v2?station_ids=${channel.site_id}&date=${date.format( + 'YYYY-MM-DD' + )}&hour_offset=${i}&hour_range=3&natco_code=at`, + { headers } + ) + ) await Promise.allSettled(promises) .then(results => { @@ -68,7 +76,7 @@ module.exports = { }, async channels() { const data = await axios - .get(`${API_ENDPOINT}/epg/channel?natco_code=at`, {headers}) + .get(`${API_ENDPOINT}/epg/channel?natco_code=at`, { headers }) .then(r => r.data) .catch(console.log) @@ -86,7 +94,7 @@ async function loadProgramDetails(item) { if (!item.program_id) return {} const url = `${API_ENDPOINT}/details/series/${item.program_id}?natco_code=at` const data = await axios - .get(url, {headers}) + .get(url, { headers }) .then(r => r.data) .catch(console.log) @@ -118,13 +126,13 @@ function parseCategory(item) { } function parseSeason(item) { - if(item.season_display_number === 'Folgen') return null + if (item.season_display_number === 'Folgen') return null return item.season_number } function parseEpisode(item) { - if(item.episode_number) return parseInt(item.episode_number) - if(item.season_display_number === 'Folgen') return item.season_number + if (item.episode_number) return parseInt(item.episode_number) + if (item.season_display_number === 'Folgen') return item.season_number return null } @@ -135,7 +143,5 @@ function parseDescription(item) { function parseRoles(item, role_name) { if (!item.roles) return null - return item.roles - .filter(role => role.role_name === role_name) - .map(role => role.person_name) + return item.roles.filter(role => role.role_name === role_name).map(role => role.person_name) } diff --git a/sites/magentatv.at/magentatv.at.test.js b/sites/tv.magenta.at/tv.magenta.at.test.js similarity index 62% rename from sites/magentatv.at/magentatv.at.test.js rename to sites/tv.magenta.at/tv.magenta.at.test.js index e5ae17a7..eb831be2 100644 --- a/sites/magentatv.at/magentatv.at.test.js +++ b/sites/tv.magenta.at/tv.magenta.at.test.js @@ -1,7 +1,7 @@ -// npm run channels:parse -- --config=./sites/magentatv.at/magentatv.at.config.js --output=./sites/magentatv.at/magentatv.at.channels.xml -// npm run grab -- --site=magentatv.at +// npm run channels:parse -- --config=./sites/tv.magenta.at/tv.magenta.at.config.js --output=./sites/tv.magenta.at/tv.magenta.at.channels.xml +// npm run grab -- --site=tv.magenta.at -const { parser, url } = require('./magentatv.at.config.js') +const { parser, url } = require('./tv.magenta.at.config.js') const fs = require('fs') const path = require('path') const axios = require('axios') @@ -23,44 +23,66 @@ const channel = { } it('can generate valid url', () => { - expect(url({ date, channel })).toBe(`${API_ENDPOINT}/epg/channel/schedules/v2?station_ids=206969383991&date=2022-10-30&hour_offset=0&hour_range=3&natco_code=at`) + expect(url({ date, channel })).toBe( + `${API_ENDPOINT}/epg/channel/schedules/v2?station_ids=206969383991&date=2022-10-30&hour_offset=0&hour_range=3&natco_code=at` + ) }) it('can parse response', async () => { const content = fs.readFileSync(path.resolve(__dirname, '__data__/content_0000.json')) axios.get.mockImplementation(url => { - if (url === `${API_ENDPOINT}/epg/channel/schedules/v2?date=2023-11-15&hour_offset=0&hour_range=3&station_ids=206969383991&natco_code=at`) { + if ( + url === + `${API_ENDPOINT}/epg/channel/schedules/v2?date=2023-11-15&hour_offset=0&hour_range=3&station_ids=206969383991&natco_code=at` + ) { return Promise.resolve({ data: fs.readFileSync(path.resolve(__dirname, '__data__/content_0300.json')) }) - } else if (url === `${API_ENDPOINT}/epg/channel/schedules/v2?date=2023-11-15&hour_offset=3&hour_range=3&station_ids=206969383991&natco_code=at`) { + } else if ( + url === + `${API_ENDPOINT}/epg/channel/schedules/v2?date=2023-11-15&hour_offset=3&hour_range=3&station_ids=206969383991&natco_code=at` + ) { return Promise.resolve({ data: fs.readFileSync(path.resolve(__dirname, '__data__/content_0600.json')) }) - } else if (url === `${API_ENDPOINT}/epg/channel/schedules/v2?date=2023-11-15&hour_offset=6&hour_range=3&station_ids=206969383991&natco_code=at`) { + } else if ( + url === + `${API_ENDPOINT}/epg/channel/schedules/v2?date=2023-11-15&hour_offset=6&hour_range=3&station_ids=206969383991&natco_code=at` + ) { return Promise.resolve({ data: fs.readFileSync(path.resolve(__dirname, '__data__/content_0900.json')) }) - } else if (url === `${API_ENDPOINT}/epg/channel/schedules/v2?date=2023-11-15&hour_offset=9&hour_range=3&station_ids=206969383991&natco_code=at`) { + } else if ( + url === + `${API_ENDPOINT}/epg/channel/schedules/v2?date=2023-11-15&hour_offset=9&hour_range=3&station_ids=206969383991&natco_code=at` + ) { return Promise.resolve({ data: fs.readFileSync(path.resolve(__dirname, '__data__/content_1200.json')) }) - } else if (url === `${API_ENDPOINT}/epg/channel/schedules/v2?date=2023-11-15&hour_offset=12&hour_range=3&station_ids=206969383991&natco_code=at`) { + } else if ( + url === + `${API_ENDPOINT}/epg/channel/schedules/v2?date=2023-11-15&hour_offset=12&hour_range=3&station_ids=206969383991&natco_code=at` + ) { return Promise.resolve({ data: fs.readFileSync(path.resolve(__dirname, '__data__/content_1500.json')) }) - } else if (url === `${API_ENDPOINT}/epg/channel/schedules/v2?date=2023-11-15&hour_offset=15&hour_range=3&station_ids=206969383991&natco_code=at`) { + } else if ( + url === + `${API_ENDPOINT}/epg/channel/schedules/v2?date=2023-11-15&hour_offset=15&hour_range=3&station_ids=206969383991&natco_code=at` + ) { return Promise.resolve({ data: fs.readFileSync(path.resolve(__dirname, '__data__/content_1800.json')) }) - } else if (url === `${API_ENDPOINT}/epg/channel/schedules/v2?date=2023-11-15&hour_offset=18&hour_range=3&station_ids=206969383991&natco_code=at`) { + } else if ( + url === + `${API_ENDPOINT}/epg/channel/schedules/v2?date=2023-11-15&hour_offset=18&hour_range=3&station_ids=206969383991&natco_code=at` + ) { return Promise.resolve({ data: fs.readFileSync(path.resolve(__dirname, '__data__/content_2100.json')) }) } else if ( - url === - `${API_ENDPOINT}/details/series/gn.tv-24101298-EP048489190016?natco_code=at` + url === `${API_ENDPOINT}/details/series/gn.tv-24101298-EP048489190016?natco_code=at` ) { return Promise.resolve({ data: JSON.parse(fs.readFileSync(path.resolve(__dirname, '__data__/program.json')))