mirror of
https://github.com/iptv-org/epg
synced 2026-09-10 13:56:51 -04:00
Properly generate TV schedule URL when redirected.
On www.tvpassport.com when schedule redirected to new URL, the requested date stripped from new URL so the fetched schedules only valid for current date. If URL was redirected, simply use the new URL with requested date appended. Signed-off-by: Toha <tohenk@yahoo.com>
This commit is contained in:
@@ -1,20 +1,28 @@
|
||||
const { parser, url } = require('./tvpassport.com.config.js')
|
||||
const axios = require('axios')
|
||||
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)
|
||||
|
||||
jest.mock('axios')
|
||||
|
||||
const date = dayjs.utc('2022-10-04', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = {
|
||||
site_id: 'youtoo-america-network/5463',
|
||||
xmltv_id: 'YTATV.us'
|
||||
}
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url({ channel, date })).toBe(
|
||||
axios.head.mockImplementation(() => {
|
||||
return Promise.resolve({})
|
||||
})
|
||||
|
||||
it('can generate valid url', async () => {
|
||||
expect(await url({ channel, date })).toBe(
|
||||
'https://www.tvpassport.com/tv-listings/stations/youtoo-america-network/5463/2022-10-04'
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user