mirror of
https://github.com/iptv-org/epg
synced 2026-09-15 05:26:25 -04:00
Update tvarenasport.hr guide.
It is now derived from tvarenasport.com. Test: ```sh npm test -- tvarenasport.com > test > run-script-os tvarenasport.com > test:win32 > SET "TZ=Pacific/Nauru" && npx jest --runInBand tvarenasport.com PASS sites/tvarenasport.com/tvarenasport.com.test.js (5.391 s) √ can generate valid url (3 ms) √ can parse response (877 ms) √ can handle empty guide (1 ms) Test Suites: 1 passed, 1 total Tests: 3 passed, 3 total Snapshots: 0 total Time: 5.555 s, estimated 6 s Ran all test suites matching /tvarenasport.com/i. ``` ```sh npm test -- tvarenasport.hr > test > run-script-os tvarenasport.hr > test:win32 > SET "TZ=Pacific/Nauru" && npx jest --runInBand tvarenasport.hr PASS sites/tvarenasport.hr/tvarenasport.hr.test.js (5.578 s) √ can generate valid url (4 ms) √ can parse response (327 ms) √ can handle empty guide (1 ms) Test Suites: 1 passed, 1 total Tests: 3 passed, 3 total Snapshots: 0 total Time: 5.774 s Ran all test suites matching /tvarenasport.hr/i. ``` Grab: ```sh npm run grab -- --site=tvarenasport.hr > grab > npx tsx scripts/commands/epg/grab.ts --site=tvarenasport.hr starting... config: output: guide.xml maxConnections: 1 gzip: false site: tvarenasport.hr loading channels... found 10 channel(s) run #1: [1/20] tvarenasport.hr (hr) - ArenaSport1.hr - Dec 10, 2024 (17 programs) [2/20] tvarenasport.hr (hr) - ArenaSport1.hr - Dec 11, 2024 (17 programs) ... [19/20] tvarenasport.hr (hr) - ArenaSport2.hr - Dec 11, 2024 (12 programs) [20/20] tvarenasport.hr (hr) - ArenaSport2.hr - Dec 10, 2024 (12 programs) saving to "guide.xml"... done in 00h 00m 11s ``` Signed-off-by: Toha <tohenk@yahoo.com>
This commit is contained in:
@@ -1,45 +1,53 @@
|
||||
const { parser, url } = require('./tvarenasport.hr.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.utc('2024-12-07', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = {
|
||||
site_id: '380',
|
||||
xmltv_id: 'ArenaSport1Croatia.hr'
|
||||
site_id: '01',
|
||||
xmltv_id: 'ArenaSport1.hr'
|
||||
}
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url({ channel, date })).toBe('https://www.tvarenasport.hr/api/schedule?date=17-11-2021')
|
||||
expect(url).toBe('https://tvarenaprogram.com/live/v2/hr')
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content =
|
||||
'{"items":[{"id":6104,"title":"NAJAVA PROGRAMA","start":"2021-11-16T23:00:00Z","end":"2021-11-17T23:00:00Z","sport":"Najava programa","league":"NAJAVA PROGRAMA","group":"1294","isLive":false,"doNotMiss":false,"domain":"cro"},{"id":6000,"title":" DIJON - UNICAJA","start":"2021-11-16T23:30:00Z","end":"2021-11-17T01:00:00Z","sport":"Košarka","league":" LIGA PRVAKA","group":"380","isLive":false,"doNotMiss":false,"domain":"cro"}]}'
|
||||
const result = parser({ channel, content }).map(p => {
|
||||
const content = fs.readFileSync(path.join(__dirname, '__data__', 'content.html'))
|
||||
const result = parser({ channel, date, content }).map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(result).toMatchObject([
|
||||
{
|
||||
start: '2021-11-16T23:30:00.000Z',
|
||||
stop: '2021-11-17T01:00:00.000Z',
|
||||
title: 'DIJON - UNICAJA',
|
||||
category: 'Košarka',
|
||||
description: 'LIGA PRVAKA'
|
||||
}
|
||||
])
|
||||
expect(result.length).toBe(15)
|
||||
expect(result[0]).toMatchObject({
|
||||
start: '2024-12-07T00:00:00.000Z',
|
||||
stop: '2024-12-07T00:30:00.000Z',
|
||||
title: 'MAGAZIN',
|
||||
description: 'NBA ACTION',
|
||||
category: 'Košarka',
|
||||
})
|
||||
expect(result[4]).toMatchObject({
|
||||
start: '2024-12-07T06:00:00.000Z',
|
||||
stop: '2024-12-07T07:30:00.000Z',
|
||||
title: 'EHF LIGA PRVAKA',
|
||||
description: 'DINAMO BUKUREŠT - PSG',
|
||||
category: 'Rukomet',
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const result = parser({
|
||||
date,
|
||||
channel,
|
||||
content: '{"channels":[]}'
|
||||
content: ''
|
||||
})
|
||||
expect(result).toMatchObject([])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user