Adds allente.fi

This commit is contained in:
freearhey 2023-12-02 18:12:25 +03:00
parent c564c42ab5
commit 919f6cfc16
5 changed files with 210 additions and 0 deletions

View file

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

View file

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<channels>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="0016">BBC News (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="0086">Nickelodeon (Nordic) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="0147">SVT Barn HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="0148">SVT1 HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="0149">Kunskapskanalen HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="0274">V sport+ Suomi HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="0282">SVT2 HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="0344">Al Jazeera English -OTT</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="0356">Viasat Nature HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="0357">Viasat History HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="0358">Viasat Explore HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="570">Nicktoons (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="596">Sky News (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="604">MTV 80s (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="668">Horse &amp; Country HD -IP</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="686">YLE 1 (F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="687">YLE 2 (F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="689">YLE Teema &amp; Fem (F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="968">MTV Aitio (F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="971">MTV Viihde (F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="972">SF Kanalen (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1001">SkyShowtime 2 (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1002">SkyShowtime 1 (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1003">HISTORY HD (N/D/F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1004">HISTORY 2 HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1005">Animal Planet HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1006">Discovery Science (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1007">DW English (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1008">Bloomberg (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1009">MOTORVISION TV HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1011">ID Investigation Discovery (N/F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1016">BBC Nordic HD (S/D/F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1024">Eurosport 2 HD (S/F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1033">France 24 (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1076">MTV3 HD (F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1077">Nelonen (F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1078">MTV Sub (F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1079">TV5 (F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1080">liv (F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1081">JIM (F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1083">Discovery Channel (F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1084">MTV Juniori (F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1085">MTV Max HD (F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1086">MTV Urheilu 1 HD (F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1087">MTV Urheilu 2 HD (F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="" site_id="1088">Eurosport 1 HD (F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="BoomerangNordic.uk" site_id="0017">Cartoonito (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="CartoonNetworkScandinavia.uk" site_id="0028">Cartoon Network (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="CNBCEurope.uk" site_id="0032">CNBC (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="CNNInternationalEurope.us" site_id="0033">CNN (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="MTV00s.uk" site_id="0246">MTV 00s (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="MTVGlobal.uk" site_id="0080">MTV (Nordic) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="NationalGeographic.fi" site_id="0084">National Geographic HD (S/F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="NickJrScandinavia.nl" site_id="0088">Nick Jr. (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="VFilmAction.se" site_id="0299">V film action HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="VFilmFamily.se" site_id="0308">V film family (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="VFilmHits.se" site_id="0322">V film hits HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="VFilmPremiere.se" site_id="0321">V film premiere HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="VSport1.fi" site_id="0159">V sport 1 Suomi HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="VSport1.se" site_id="0362">V sport 1 HD (S/F) (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="VSport2.fi" site_id="488">V sport 2 Suomi HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="VSportFootball.se" site_id="0269">V sport football HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="VSportGolf.se" site_id="0364">V sport golf HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="VSportLive1.se" site_id="0255">V sport live 1 (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="VSportLive2.se" site_id="0256">V sport live 2 (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="VSportLive3.se" site_id="0257">V sport live 3 (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="VSportLive4.se" site_id="0258">V sport live 4 (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="VSportLive5.se" site_id="0259">V sport live 5 (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="VSportPremium.se" site_id="527">V sport premium HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="VSportUltraHD.se" site_id="418">V sport ultra HD (T)</channel>
<channel site="allente.fi" lang="fi" xmltv_id="VSportVinter.se" site_id="0363">V sport vinter HD (T)</channel>
</channels>

View file

@ -0,0 +1,65 @@
const dayjs = require('dayjs')
module.exports = {
site: 'allente.fi',
days: 2,
request: {
cache: {
ttl: 60 * 60 * 1000 // 1 hour
}
},
url({ date }) {
return `https://cs-vcb.allente.fi/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.fi/epg/events?date=${dayjs().format('YYYY-MM-DD')}`)
.then(r => r.data)
.catch(console.log)
return data.channels.map(item => {
return {
lang: 'fi',
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.fi.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.fi/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.fi
https://www.allente.fi/tv-guide/
### Download the guide
```sh
npm run grab -- --site=allente.fi
```
### Update channel list
```sh
npm run channels:parse -- --config=./sites/allente.fi/allente.fi.config.js --output=./sites/allente.fi/allente.fi.channels.xml
```
### Test
```sh
npm test -- allente.fi
```