mirror of
https://github.com/iptv-org/epg
synced 2026-03-21 19:30:52 -04:00
increased timeout & added range for days
This commit is contained in:
@@ -14,14 +14,24 @@ dayjs.extend(customParseFormat)
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'distro.tv',
|
site: 'distro.tv',
|
||||||
days: 2,
|
days: 3,
|
||||||
request: {
|
request: {
|
||||||
headers: HEADERS
|
headers: HEADERS,
|
||||||
|
timeout: 60000
|
||||||
},
|
},
|
||||||
url({ channel }) {
|
url({ channel, date }) {
|
||||||
const days = module.exports.days || 2
|
const diff = date.diff(dayjs.utc().startOf('d'), 'd')
|
||||||
const hours = days * 24
|
let range
|
||||||
return `https://tv.jsrdn.com/epg/query.php?range=now,${hours}h&id=${channel.site_id},`
|
|
||||||
|
if (diff <= 0) {
|
||||||
|
range = 'now,24h'
|
||||||
|
} else {
|
||||||
|
const start = diff * 24
|
||||||
|
const end = (diff + 1) * 24
|
||||||
|
range = `${start}h,${end}h`
|
||||||
|
}
|
||||||
|
|
||||||
|
return `https://tv.jsrdn.com/epg/query.php?range=${range}&id=${channel.site_id},`
|
||||||
},
|
},
|
||||||
parser({ content, channel }) {
|
parser({ content, channel }) {
|
||||||
if (!content || !channel) return []
|
if (!content || !channel) return []
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ dayjs.extend(utc)
|
|||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
jest.mock('axios')
|
jest.mock('axios')
|
||||||
|
|
||||||
const date = dayjs.utc('2026-02-10', 'YYYY-MM-DD').startOf('d')
|
const date = dayjs.utc().add(1, 'd').startOf('d')
|
||||||
const channel = {
|
const channel = {
|
||||||
site_id: '45143'
|
site_id: '45143'
|
||||||
}
|
}
|
||||||
|
|
||||||
it('can generate valid url', () => {
|
it('can generate valid url', () => {
|
||||||
expect(url({ channel, date })).toBe(
|
expect(url({ channel, date })).toBe(
|
||||||
'https://tv.jsrdn.com/epg/query.php?range=now,48h&id=45143,'
|
'https://tv.jsrdn.com/epg/query.php?range=24h,48h&id=45143,'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user