mirror of
https://github.com/iptv-org/epg
synced 2026-09-12 06:46:50 -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,50 +1,8 @@
|
||||
const axios = require('axios')
|
||||
const dayjs = require('dayjs')
|
||||
const tvarenasport = require('../tvarenasport.com/tvarenasport.com.config')
|
||||
|
||||
module.exports = {
|
||||
module.exports = Object.assign(tvarenasport, {
|
||||
site: 'tvarenasport.hr',
|
||||
days: 2,
|
||||
url: function ({ date }) {
|
||||
return `https://www.tvarenasport.hr/api/schedule?date=${date.format('DD-MM-YYYY')}`
|
||||
},
|
||||
parser: function ({ content, channel }) {
|
||||
let programs = []
|
||||
const items = parseItems(content, channel)
|
||||
items.forEach(item => {
|
||||
programs.push({
|
||||
title: item.title.trim(),
|
||||
category: item.sport,
|
||||
description: item.league.trim(),
|
||||
start: dayjs(item.start),
|
||||
stop: dayjs(item.end)
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels() {
|
||||
const data = await axios
|
||||
.get('https://www.tvarenasport.hr/api/schedule')
|
||||
.then(r => r.data)
|
||||
.catch(console.log)
|
||||
|
||||
const channels = []
|
||||
for (let id in data.channels) {
|
||||
const item = data.channels[id]
|
||||
channels.push({
|
||||
lang: 'hr',
|
||||
site_id: id,
|
||||
name: item.name
|
||||
})
|
||||
}
|
||||
|
||||
return channels
|
||||
}
|
||||
}
|
||||
|
||||
function parseItems(content, channel) {
|
||||
const data = JSON.parse(content)
|
||||
if (!data || !Array.isArray(data.items)) return []
|
||||
|
||||
return data.items.filter(i => i.group === channel.site_id)
|
||||
}
|
||||
tz: 'Europe/Budapest',
|
||||
lang: 'hr',
|
||||
url: 'https://tvarenaprogram.com/live/v2/hr',
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user