Update digiturk.com.tr guide.
Test: ```sh npm test --- digiturk.com.tr > test > run-script-os digiturk.com.tr > test:win32 > SET "TZ=Pacific/Nauru" && npx jest --runInBand digiturk.com.tr PASS sites/digiturk.com.tr/digiturk.com.tr.test.js √ can generate valid url (3 ms) √ can parse response (167 ms) √ can handle empty guide (1 ms) Test Suites: 1 passed, 1 total Tests: 3 passed, 3 total Snapshots: 0 total Time: 0.918 s, estimated 1 s Ran all test suites matching /digiturk.com.tr/i. ``` Grab: ```sh npm run grab --- --site=digiturk.com.tr > grab > npx tsx scripts/commands/epg/grab.ts --site=digiturk.com.tr starting... config: output: guide.xml maxConnections: 1 gzip: false site: digiturk.com.tr loading channels... found 108 channel(s) run #1: [1/216] digiturk.com.tr (tr) - 212 - Jan 12, 2025 (56 programs) [2/216] digiturk.com.tr (tr) - 212 - Jan 13, 2025 (58 programs) ... [215/216] digiturk.com.tr (tr) - VavTV.tr - Jan 13, 2025 (18 programs) [216/216] digiturk.com.tr (tr) - TVNET.tr - Jan 13, 2025 (32 programs) saving to "guide.xml"... done in 00h 02m 10s ``` Signed-off-by: Toha <tohenk@yahoo.com>
This commit is contained in:
5 files changed
+755
-237
No files matched your search
@@ -4,44 +4,45 @@ 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('2023-01-19', 'YYYY-MM-DD').startOf('d')
|
||||
const date = dayjs.utc('2025-01-12', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = {
|
||||
site_id: '14',
|
||||
xmltv_id: 'beINMovies2Action.qa'
|
||||
site_id: '351',
|
||||
xmltv_id: 'Nickelodeon.tr'
|
||||
}
|
||||
|
||||
it('can generate valid url', () => {
|
||||
const result = url({ date, channel })
|
||||
expect(result).toBe(
|
||||
'https://www.digiturk.com.tr/_Ajax/getBroadcast.aspx?channelNo=14&date=19.01.2023&tomorrow=false&primetime=false'
|
||||
'https://www.digiturk.com.tr/Ajax/GetTvGuideFromDigiturk?Day=01%2F12%2F2025+00%3A00%3A00'
|
||||
)
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
|
||||
const results = parser({ content }).map(p => {
|
||||
const content = fs.readFileSync(path.join(__dirname, '__data__', 'content.html'))
|
||||
const results = parser({ content, channel, date }).map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results.length).toBe(57)
|
||||
expect(results[0]).toMatchObject({
|
||||
start: '2023-01-18T20:40:00.000Z',
|
||||
stop: '2023-01-18T22:32:00.000Z',
|
||||
title: 'PARÇALANMIŞ'
|
||||
start: '2025-01-11T21:00:00.000Z',
|
||||
stop: '2025-01-11T21:25:00.000Z',
|
||||
title: 'Sünger Bob Kare Pantolon'
|
||||
})
|
||||
|
||||
expect(results[10]).toMatchObject({
|
||||
start: '2023-01-19T05:04:00.000Z',
|
||||
stop: '2023-01-19T06:42:00.000Z',
|
||||
title: 'HIZLI VE ÖFKELİ: TOKYO YARIŞI'
|
||||
expect(results[56]).toMatchObject({
|
||||
start: '2025-01-12T17:40:00.000Z',
|
||||
stop: '2025-01-12T18:00:00.000Z',
|
||||
title: 'Casagrande Ailesi'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const result = parser({ content: '' })
|
||||
const result = parser({ content: '', channel, date })
|
||||
expect(result).toMatchObject([])
|
||||
})
|
||||
Reference in new issue
Block a user