diff --git a/sites/allente.se/allente.se_se.channels.xml b/sites/allente.se/allente.se.channels.xml similarity index 57% rename from sites/allente.se/allente.se_se.channels.xml rename to sites/allente.se/allente.se.channels.xml index 2b988b33..c99d49e6 100644 --- a/sites/allente.se/allente.se_se.channels.xml +++ b/sites/allente.se/allente.se.channels.xml @@ -1,95 +1,95 @@ - Al Jazeera English -OTT - Animal Planet HD (T) - ATG Live HD (T) - Axess TV HD -IP - BBC Nordic HD (S/D/F) (T) - BBC News (T) - Bloomberg (T) - Cartoonito (T) - Cartoon Network (T) - TV4 Fotboll (T) - TV4 Hits (T) - TV4 Hockey (T) - TV4 Sport Live 2 (T) - TV4 Sport Live 3 (T) - TV4 Sport Live 4 (T) - TV4 Sport Live 1 (T) - TV4 Motor (T) - TV4 Stars (T) - CNBC (T) - CNN (T) - Discovery Channel HD (S) (T) - Discovery Science (T) - DR1 HD (T) - DR2 HD (T) - DR Ramasjang (T) - DW English (T) - Eurosport 1 HD (S) (T) - Eurosport 2 HD (S/F) (T) - France 24 (T) - Godare HD -IP - HISTORY 2 HD (T) - HISTORY HD (S) (T) - Horse & Country HD -IP - ID Investigation Discovery (S) (T) - Kanal 5 HD (S) (T) - Kanal 9 HD (S) (T) - Kanal 11 HD (S) (T) - Kunskapskanalen HD (T) - MOTORVISION TV HD (T) - MTV 00s (T) - MTV 80s (T) - MTV (Nordic) (T) - National Geographic HD (S/F) (T) - Nickelodeon (Nordic) (T) - Nick Jr. (T) - Nicktoons (T) - NRK1 HD (T) - NRK2 HD (T) - NRK3/ NRK Super HD (T) - SkyShowtime 2 (T) - SkyShowtime 1 (T) - SF Kanalen (T) - Sjuan HD (S) (T) - Sky News (T) - TV4 Sportkanalen (T) - SVT1 HD (T) - SVT2 HD (T) - SVT24 HD (T) - SVT Barn HD (T) - TLC Sverige HD (T) - TV 2 HD (D) (T) - TV3 HD (S) (T) - TV4 HD (T) - TV4 Fakta (T) - TV4 Film (T) - TV4 Guld (T) - TV4 Tennis (T) - TV6 HD (S) (T) - TV8 HD (S) (T) - TV10 HD (S) (T) - TV12 HD (S) (T) - V film action HD (T) - V film family (T) - V film hits HD (T) - V film premiere HD (T) - Viasat Explore HD (T) - Viasat History HD (T) - Viasat Nature HD (T) - V series HD (T) - V sport 1 HD (S/F) (T) - V sport extra HD (T) - V sport football HD (T) - V sport golf HD (T) - V sport live 1 (T) - V sport live 2 (T) - V sport live 3 (T) - V sport live 4 (T) - V sport live 5 (T) - V sport motor HD (T) - V sport premium HD (T) - V sport ultra HD (T) - V sport vinter HD (T) + Al Jazeera English -OTT + Animal Planet HD (T) + ATG Live HD (T) + Axess TV HD -IP + BBC Nordic HD (S/D/F) (T) + BBC News (T) + Bloomberg (T) + Cartoonito (T) + Cartoon Network (T) + TV4 Fotboll (T) + TV4 Hits (T) + TV4 Hockey (T) + TV4 Sport Live 2 (T) + TV4 Sport Live 3 (T) + TV4 Sport Live 4 (T) + TV4 Sport Live 1 (T) + TV4 Motor (T) + TV4 Stars (T) + CNBC (T) + CNN (T) + Discovery Channel HD (S) (T) + Discovery Science (T) + DR1 HD (T) + DR2 HD (T) + DR Ramasjang (T) + DW English (T) + Eurosport 1 HD (S) (T) + Eurosport 2 HD (S/F) (T) + France 24 (T) + Godare HD -IP + HISTORY 2 HD (T) + HISTORY HD (S) (T) + Horse & Country HD -IP + ID Investigation Discovery (S) (T) + Kanal 5 HD (S) (T) + Kanal 9 HD (S) (T) + Kanal 11 HD (S) (T) + Kunskapskanalen HD (T) + MOTORVISION TV HD (T) + MTV 00s (T) + MTV 80s (T) + MTV (Nordic) (T) + National Geographic HD (S/F) (T) + Nickelodeon (Nordic) (T) + Nick Jr. (T) + Nicktoons (T) + NRK1 HD (T) + NRK2 HD (T) + NRK3/ NRK Super HD (T) + SkyShowtime 2 (T) + SkyShowtime 1 (T) + SF Kanalen (T) + Sjuan HD (S) (T) + Sky News (T) + TV4 Sportkanalen (T) + SVT1 HD (T) + SVT2 HD (T) + SVT24 HD (T) + SVT Barn HD (T) + TLC Sverige HD (T) + TV 2 HD (D) (T) + TV3 HD (S) (T) + TV4 HD (T) + TV4 Fakta (T) + TV4 Film (T) + TV4 Guld (T) + TV4 Tennis (T) + TV6 HD (S) (T) + TV8 HD (S) (T) + TV10 HD (S) (T) + TV12 HD (S) (T) + V film action HD (T) + V film family (T) + V film hits HD (T) + V film premiere HD (T) + Viasat Explore HD (T) + Viasat History HD (T) + Viasat Nature HD (T) + V series HD (T) + V sport 1 HD (S/F) (T) + V sport extra HD (T) + V sport football HD (T) + V sport golf HD (T) + V sport live 1 (T) + V sport live 2 (T) + V sport live 3 (T) + V sport live 4 (T) + V sport live 5 (T) + V sport motor HD (T) + V sport premium HD (T) + V sport ultra HD (T) + V sport vinter HD (T) diff --git a/sites/allente.se/allente.se.config.js b/sites/allente.se/allente.se.config.js index d07b5e6e..87d30fe9 100644 --- a/sites/allente.se/allente.se.config.js +++ b/sites/allente.se/allente.se.config.js @@ -3,10 +3,13 @@ const dayjs = require('dayjs') module.exports = { site: 'allente.se', days: 2, - url({ date, channel }) { - const [country] = channel.site_id.split('#') - - return `https://cs-vcb.allente.${country}/epg/events?date=${date.format('YYYY-MM-DD')}` + request: { + cache: { + ttl: 60 * 60 * 1000 // 1 hour + } + }, + url({ date }) { + return `https://cs-vcb.allente.se/epg/events?date=${date.format('YYYY-MM-DD')}` }, parser({ content, channel }) { let programs = [] @@ -29,17 +32,17 @@ module.exports = { return programs }, - async channels({ country, lang }) { + async channels() { const axios = require('axios') const data = await axios - .get(`https://cs-vcb.allente.${country}/epg/events?date=${dayjs().format('YYYY-MM-DD')}`) + .get(`https://cs-vcb.allente.se/epg/events?date=${dayjs().format('YYYY-MM-DD')}`) .then(r => r.data) .catch(console.log) return data.channels.map(item => { return { - lang, - site_id: `${country}#${item.id}`, + lang: 'sv', + site_id: item.id, name: item.name } }) @@ -47,10 +50,9 @@ module.exports = { } function parseItems(content, channel) { - const [, channelId] = channel.site_id.split('#') const data = JSON.parse(content) if (!data || !Array.isArray(data.channels)) return [] - const channelData = data.channels.find(i => i.id === channelId) + const channelData = data.channels.find(i => i.id === channel.site_id) return channelData && Array.isArray(channelData.events) ? channelData.events : [] } diff --git a/sites/allente.se/allente.se.test.js b/sites/allente.se/allente.se.test.js index f869aff4..225d39c6 100644 --- a/sites/allente.se/allente.se.test.js +++ b/sites/allente.se/allente.se.test.js @@ -1,9 +1,3 @@ -// npm run channels:parse -- --config=./sites/allente.se/allente.se.config.js --output=./sites/allente.se/allente.se_se.channels.xml --set=country:se --set=lang:sv -// npm run channels:parse -- --config=./sites/allente.se/allente.se.config.js --output=./sites/allente.se/allente.se_fi.channels.xml --set=country:fi --set=lang:fi -// npm run channels:parse -- --config=./sites/allente.se/allente.se.config.js --output=./sites/allente.se/allente.se_no.channels.xml --set=country:no --set=lang:no -// npm run channels:parse -- --config=./sites/allente.se/allente.se.config.js --output=./sites/allente.se/allente.se_dk.channels.xml --set=country:dk --set=lang:da -// npm run grab -- --site=allente.se - const { parser, url } = require('./allente.se.config.js') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') @@ -13,7 +7,7 @@ dayjs.extend(utc) const date = dayjs.utc('2021-11-17', 'YYYY-MM-DD').startOf('d') const channel = { - site_id: 'se#0148', + site_id: '0148', xmltv_id: 'SVT1.se' } @@ -21,13 +15,6 @@ it('can generate valid url', () => { expect(url({ date, channel })).toBe('https://cs-vcb.allente.se/epg/events?date=2021-11-17') }) -it('can generate valid url for different country', () => { - const dkChannel = { site_id: 'dk#0148' } - expect(url({ date, channel: dkChannel })).toBe( - 'https://cs-vcb.allente.dk/epg/events?date=2021-11-17' - ) -}) - it('can parse response', () => { const content = '{"channels":[{"id":"0148","icon":"//images.ctfassets.net/989y85n5kcxs/5uT9g9pdQWRZeDPQXVI9g6/9cc44da567f591822ed645c99ecdcb64/SVT_1_black_new__2_.png","name":"SVT1 HD (T)","events":[{"id":"0086202208220710","live":false,"time":"2022-08-22T07:10:00Z","title":"Hemmagympa med Sofia","details":{"title":"Hemmagympa med Sofia","image":"https://viasatps.api.comspace.se/PS/channeldate/image/viasat.ps/21/2022-08-22/se.cs.svt1.event.A_41214031600.jpg?size=2560x1440","description":"Svenskt träningsprogram från 2021. Styrka. Sofia Åhman leder SVT:s hemmagympapass. Denna gång fokuserar vi på styrka.","season":4,"episode":1,"categories":["other"],"duration":"20"}}]}]}' diff --git a/sites/allente.se/allente.se_dk.channels.xml b/sites/allente.se/allente.se_dk.channels.xml deleted file mode 100644 index a6f92d83..00000000 --- a/sites/allente.se/allente.se_dk.channels.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - 6'eren HD (D) (T) - Al Jazeera English -OTT - BBC News (T) - Cartoonito (T) - CANAL9 HD (D) (T) - Cartoon Network (T) - CNBC (T) - CNN (T) - dk4 (T) - DR1 HD (T) - DR2 HD (T) - DR Ramasjang (T) - Eurosport 2 HD (D) (T) - Kanal 4 HD (D) (T) - Kanal 5 HD (D) (T) - MTV 00s (T) - MTV 80s (T) - MTV (Nordic) (T) - National Geographic HD (D) (T) - Nick Jr. (T) - Nicktoons (T) - NRK1 HD (T) - TV 2 HD (D) (T) - TV 2 Charlie HD (D) (T) - TV 2 Fri HD (D) (T) - TV 2 News HD (D) (T) - TV 2 Sport HD (D) (T) - TV 2 Echo HD (D) (T) - TV3 HD (D) (T) - TV3 MAX HD (D) (T) - TV3+ HD (D) (T) - TV3 Puls HD (D) (T) - TV3 Sport HD (D) (T) - TV4 HD (T) - V film action HD (T) - V film family (T) - V film hits HD (T) - V film premiere HD (T) - Viasat Explore HD (T) - Viasat History HD (T) - V series HD (T) - V sport golf HD (T) - V sport ultra HD (T) - See (D) (T) - diff --git a/sites/allente.se/allente.se_fi.channels.xml b/sites/allente.se/allente.se_fi.channels.xml deleted file mode 100644 index 74dfae2a..00000000 --- a/sites/allente.se/allente.se_fi.channels.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - Cartoonito (T) - Cartoon Network (T) - CNBC (T) - CNN (T) - MTV 00s (T) - MTV (Nordic) (T) - National Geographic HD (S/F) (T) - Nick Jr. (T) - V film action HD (T) - V film family (T) - V film hits HD (T) - V film premiere HD (T) - V sport 1 Suomi HD (T) - V sport 1 HD (S/F) (T) - V sport 2 Suomi HD (T) - V sport football HD (T) - V sport golf HD (T) - V sport live 1 (T) - V sport live 2 (T) - V sport live 3 (T) - V sport live 4 (T) - V sport live 5 (T) - V sport premium HD (T) - V sport ultra HD (T) - V sport vinter HD (T) - diff --git a/sites/allente.se/allente.se_no.channels.xml b/sites/allente.se/allente.se_no.channels.xml deleted file mode 100644 index a59d32a3..00000000 --- a/sites/allente.se/allente.se_no.channels.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - Al Jazeera English -OTT - BBC News (T) - Cartoon Network (T) - CNBC (T) - CNN (T) - Discovery Channel HD (N) (T) - DR2 HD (T) - Eurosport 1 HD (N) (T) - Eurosport Norge HD (T) - FEM HD (T) - Kunskapskanalen HD (T) - MAX HD (T) - MTV 00s (T) - MTV 80s (T) - MTV (Nordic) (T) - National Geographic HD (N) (T) - Nick Jr. (T) - Nicktoons (T) - NRK1 HD (T) - NRK2 HD (T) - NRK3/ NRK Super HD (T) - SVT1 HD (T) - SVT2 HD (T) - SVT Barn HD (T) - TV 2 HD (D) (T) - TV2 Direkte (N) (T) - TV2 Livsstil HD (N) (T) - TV2 Nyheter (N) (T) - TV2 Sport 1 HD (N) (T) - TV2 Sport 2 HD (N) (T) - TV2 Sport Premium HD (N) (T) - TV2 Zebra HD (N) (T) - TV3 HD (N) (T) - TV6 (N) (T) - TV Norge HD (T) - TV3+ (N) (T) - V film action HD (T) - V film family (T) - V film hits HD (T) - V film premiere HD (T) - Viasat Explore HD (T) - Viasat History HD (T) - VOX HD (T) - V series HD (T) - V sport 1 HD (N) (T) - V sport 2 HD (N) (T) - V sport 3 HD (N) (T) - V sport golf HD (T) - V sport live 1 (T) - V sport live 2 (T) - V sport live 3 (T) - V sport live 4 (T) - V sport live 5 (T) - V sport+ HD (N) (T) - V sport ultra HD (T) - diff --git a/sites/allente.se/readme.md b/sites/allente.se/readme.md new file mode 100644 index 00000000..3f014fd3 --- /dev/null +++ b/sites/allente.se/readme.md @@ -0,0 +1,21 @@ +# allente.se + +https://www.allente.se/tv-guide/ + +### Download the guide + +```sh +npm run grab -- --site=allente.se +``` + +### Update channel list + +```sh +npm run channels:parse -- --config=./sites/allente.se/allente.se.config.js --output=./sites/allente.se/allente.se.channels.xml +``` + +### Test + +```sh +npm test -- allente.se +```