Update allente sites.

Signed-off-by: Toha <tohenk@yahoo.com>
This commit is contained in:
Toha
2026-07-04 19:32:45 +07:00
parent 41a54452e8
commit f59a46bb00
26 changed files with 257889 additions and 421 deletions
+31 -35
View File
@@ -2,51 +2,47 @@ const { parser, url } = require('./allente.no.config.js')
const fs = require('fs')
const path = require('path')
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 date = dayjs('2026-06-28').startOf('d')
const channel = {
site_id: 'se#0148',
xmltv_id: 'SVT1.se'
site_id: '20001'
}
it('can generate valid url', () => {
if (channel.site_id.split('#')[0] !== 'se') {
expect(url({ channel, date })).toBe('https://cs-vcb.allente.se/epg/events?date=2021-11-17')
} else if (channel.site_id.split('#')[0] === 'fi') {
expect(url({ channel, date })).toBe('https://cs-vcb.allente.fi/epg/events?date=2021-11-17')
} else if (channel.site_id.split('#')[0] === 'no') {
expect(url({ channel, date })).toBe('https://cs-vcb.allente.no/epg/events?date=2021-11-17')
} else if (channel.site_id.split('#')[0] === 'dk') {
expect(url({ channel, date })).toBe('https://cs-vcb.allente.dk/epg/events?date=2021-11-17')
}
expect(url({ date })).toBe('https://www.allente.no/api/epg/refetch-epg-data?Start=2026-06-28')
})
it('can parse response', () => {
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
const result = parser({ content, channel }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
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.',
image:
'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
}
])
expect(result.length).toBe(26)
expect(result[2]).toMatchObject({
start: '2026-06-28T03:30:00.000Z',
stop: '2026-06-28T04:00:00.000Z',
title: 'Trucks!',
description:
'The hosts present viewers with all of the latest trends and models for trucks while also demonstrating a series of how-to projects.',
category: ['Livsstil', 'Antikviteter'],
image:
'https://allente-imgmgr.akamaized.net/11823019554723227163.jpg?im=Resize,width=600,%20height=338',
season: 19,
episode: 6,
year: '2026'
})
expect(result[25]).toMatchObject({
start: '2026-06-28T23:30:00.000Z',
stop: '2026-06-29T03:00:00.000Z',
title: 'Airing Break',
category: ['Diverse'],
season: null,
episode: null
})
})
it('can handle empty guide', () => {