mirror of
https://github.com/iptv-org/epg
synced 2026-09-09 21:36:50 -04:00
Fix dna.fi guide: full-day results, hard errors on bad responses
The grabber requested each day as a fixed UTC+2 window. The API's broadcast days start at 04:00 Europe/Helsinki, so during daylight saving time (UTC+3) the misaligned interval was answered with a "303 See Other" redirect to a widened two-day window. On top of that the API paginates 20 items per response by default, so each day was truncated to the first ~20 programmes. - Request the exact broadcast-day window in Europe/Helsinki time - Add limit=1000 so a full day fits in one response - Drop the local-timezone day filter: the requested interval already bounds the results, and the filter discarded late-night programmes depending on the runner's timezone - Throw on malformed or unrecognized responses instead of returning an empty list, so failures are reported as errors rather than a silently empty (but "successful") guide
This commit is contained in:
@@ -15,7 +15,14 @@ const channel = {
|
||||
|
||||
it('can generate valid url', async () => {
|
||||
expect(url({ date, channel })).toBe(
|
||||
'https://mts-pro-envoy-vip.dna.fi/hbx/api/pub/xrtv/g/media?q=channel:ch-216356&q=profile:pr&q=start-interval:1736906400000/1736992799000'
|
||||
'https://mts-pro-envoy-vip.dna.fi/hbx/api/pub/xrtv/g/media?q=channel:ch-216356&q=profile:pr&q=start-interval:1736906400000/1736992799000&limit=1000'
|
||||
)
|
||||
})
|
||||
|
||||
it('can generate valid url during daylight saving time', async () => {
|
||||
const dstDate = dayjs.utc('2025-07-15', 'YYYY-MM-DD').startOf('d')
|
||||
expect(url({ date: dstDate, channel })).toBe(
|
||||
'https://mts-pro-envoy-vip.dna.fi/hbx/api/pub/xrtv/g/media?q=channel:ch-216356&q=profile:pr&q=start-interval:1752541200000/1752627599000&limit=1000'
|
||||
)
|
||||
})
|
||||
|
||||
@@ -136,3 +143,10 @@ it('can handle empty guide', () => {
|
||||
|
||||
expect(results).toMatchObject([])
|
||||
})
|
||||
|
||||
it('throws on unexpected response', () => {
|
||||
expect(() => parser({ date, content: '<html>Error</html>' })).toThrow()
|
||||
expect(() => parser({ date, content: '{"message":"Internal Server Error"}' })).toThrow(
|
||||
'Unexpected response structure'
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user