Adds allente.dk

This commit is contained in:
freearhey 2023-12-02 18:05:31 +03:00
parent 45165cdaa1
commit c564c42ab5
5 changed files with 213 additions and 0 deletions

View file

@ -4,6 +4,7 @@
| ------------------------------------------------------------------ | ------ | ------------------------------------------- |
| [9tv.co.il](sites/9tv.co.il) | 🟢 | |
| [abc.net.au](sites/abc.net.au) | 🟢 | |
| [allente.dk](sites/allente.dk) | 🟢 | |
| [allente.se](sites/allente.se) | 🟢 | |
| [andorradifusio.ad](sites/andorradifusio.ad) | 🟢 | |
| [anteltv.com.uy](sites/anteltv.com.uy) | 🟢 | |

View file

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<channels>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="0086">Nickelodeon (Nordic) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="0148">SVT1 HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="0255">V sport live 1 (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="0256">V sport live 2 (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="0257">V sport live 3 (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="0258">V sport live 4 (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="0259">V sport live 5 (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="0282">SVT2 HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="0288">NRK2 HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="0289">NRK3/ NRK Super HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="0356">Viasat Nature HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="596">Sky News (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="668">Horse &amp; Country HD -IP</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="718">TV 2 Sport X HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="1001">SkyShowtime 2 (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="1002">SkyShowtime 1 (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="1003">HISTORY HD (N/D/F) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="1004">HISTORY 2 HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="1005">Animal Planet HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="1006">Discovery Science (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="1007">DW English (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="1008">Bloomberg (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="1009">MOTORVISION TV HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="1013">ID Investigation Discovery (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="1014">TLC Danmark (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="1015">Sport Live (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="1016">BBC Nordic HD (S/D/F) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="1033">France 24 (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="1074">Discovery Channel HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="" site_id="1075">Eurosport 1 HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="6eren.dk" site_id="568">6&apos;eren HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="AlJazeeraEnglish.qa" site_id="0344">Al Jazeera English -OTT</channel>
<channel site="allente.dk" lang="da" xmltv_id="BBCNewsEurope.uk" site_id="0016">BBC News (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="BoomerangNordic.uk" site_id="0017">Cartoonito (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="Canal9.dk" site_id="0368">CANAL9 HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="CartoonNetworkScandinavia.uk" site_id="0028">Cartoon Network (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="CNBCEurope.uk" site_id="0032">CNBC (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="CNNInternationalEurope.us" site_id="0033">CNN (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="dk4.dk" site_id="0376">dk4 (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="DR1.dk" site_id="452">DR1 HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="DR2.dk" site_id="0051">DR2 HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="DRRamasjang.dk" site_id="0048">DR Ramasjang (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="Eurosport2.dk" site_id="0367">Eurosport 2 HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="Kanal4.dk" site_id="0064">Kanal 4 HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="Kanal5.dk" site_id="0065">Kanal 5 HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="MTV00s.uk" site_id="0246">MTV 00s (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="MTV80s.uk" site_id="604">MTV 80s (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="MTVGlobal.uk" site_id="0076">MTV (Nordic) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="NationalGeographic.dk" site_id="0317">National Geographic HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="NickJrScandinavia.nl" site_id="0088">Nick Jr. (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="NicktoonsScandinavia.nl" site_id="570">Nicktoons (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="NRK1.no" site_id="0090">NRK1 HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="TV2.dk" site_id="0297">TV 2 HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="TV2Charlie.dk" site_id="0180">TV 2 Charlie HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="TV2Fri.dk" site_id="0378">TV 2 Fri HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="TV2News.dk" site_id="0190">TV 2 News HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="TV2Sport.dk" site_id="454">TV 2 Sport HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="TV2Zulu.dk" site_id="0209">TV 2 Echo HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="TV3.dk" site_id="0359">TV3 HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="TV3Max.dk" site_id="0374">TV3 MAX HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="TV3Plus.dk" site_id="0248">TV3+ HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="TV3Puls.dk" site_id="665">TV3 Puls HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="TV3Sport.dk" site_id="0200">TV3 Sport HD (D) (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="TV4.se" site_id="0227">TV4 HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="VFilmAction.se" site_id="0299">V film action HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="VFilmFamily.se" site_id="0308">V film family (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="VFilmHits.se" site_id="0322">V film hits HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="VFilmPremiere.se" site_id="0321">V film premiere HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="ViasatExplore.se" site_id="0358">Viasat Explore HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="ViasatHistory.se" site_id="0357">Viasat History HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="VSeries.se" site_id="0320">V series HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="VSportGolf.se" site_id="0364">V sport golf HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="VSportUltraHD.se" site_id="418">V sport ultra HD (T)</channel>
<channel site="allente.dk" lang="da" xmltv_id="Xee.dk" site_id="707">See (D) (T)</channel>
</channels>

View file

@ -0,0 +1,65 @@
const dayjs = require('dayjs')
module.exports = {
site: 'allente.dk',
days: 2,
request: {
cache: {
ttl: 60 * 60 * 1000 // 1 hour
}
},
url({ date }) {
return `https://cs-vcb.allente.dk/epg/events?date=${date.format('YYYY-MM-DD')}`
},
parser({ content, channel }) {
let programs = []
const items = parseItems(content, channel)
items.forEach(item => {
if (!item.details) return
const start = dayjs(item.time)
const stop = start.add(item.details.duration, 'm')
programs.push({
title: item.title,
category: item.details.categories,
description: item.details.description,
icon: item.details.image,
season: parseSeason(item),
episode: parseEpisode(item),
start,
stop
})
})
return programs
},
async channels() {
const axios = require('axios')
const data = await axios
.get(`https://cs-vcb.allente.dk/epg/events?date=${dayjs().format('YYYY-MM-DD')}`)
.then(r => r.data)
.catch(console.log)
return data.channels.map(item => {
return {
lang: 'da',
site_id: item.id,
name: item.name
}
})
}
}
function parseItems(content, channel) {
const data = JSON.parse(content)
if (!data || !Array.isArray(data.channels)) return []
const channelData = data.channels.find(i => i.id === channel.site_id)
return channelData && Array.isArray(channelData.events) ? channelData.events : []
}
function parseSeason(item) {
return item.details.season || null
}
function parseEpisode(item) {
return item.details.episode || null
}

View file

@ -0,0 +1,49 @@
const { parser, url } = require('./allente.dk.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('2021-11-17', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: '0148',
xmltv_id: 'SVT1.se'
}
it('can generate valid url', () => {
expect(url({ date, channel })).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"}}]}]}'
const result = parser({ content, channel }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(result).toMatchObject([
{
start: '2022-08-22T07:10:00.000Z',
stop: '2022-08-22T07:30:00.000Z',
title: 'Hemmagympa med Sofia',
category: ['other'],
description:
'Svenskt träningsprogram från 2021. Styrka. Sofia Åhman leder SVT:s hemmagympapass. Denna gång fokuserar vi på styrka.',
icon: 'https://viasatps.api.comspace.se/PS/channeldate/image/viasat.ps/21/2022-08-22/se.cs.svt1.event.A_41214031600.jpg?size=2560x1440',
season: 4,
episode: 1
}
])
})
it('can handle empty guide', () => {
const result = parser({
date,
channel,
content: '{"date":"2001-11-17","categories":[],"channels":[]}'
})
expect(result).toMatchObject([])
})

View file

@ -0,0 +1,21 @@
# allente.dk
https://www.allente.dk/tv-guide/
### Download the guide
```sh
npm run grab -- --site=allente.dk
```
### Update channel list
```sh
npm run channels:parse -- --config=./sites/allente.dk/allente.dk.config.js --output=./sites/allente.dk/allente.dk.channels.xml
```
### Test
```sh
npm test -- allente.dk
```