mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update osn.com guide.
Test ``` npm test -- osn.com > test > run-script-os osn.com > test:win32 > SET "TZ=Pacific/Nauru" && npx jest --runInBand osn.com PASS sites/osn.com/osn.com.test.js (5.194 s) √ can generate valid request headers (6 ms) √ can generate valid url (2 ms) √ can parse response (ar) (112 ms) √ can parse response (en) (9 ms) √ can handle empty guide (1 ms) Test Suites: 1 passed, 1 total Tests: 5 passed, 5 total Snapshots: 0 total Time: 5.499 s Ran all test suites matching /osn.com/i. ``` Grab ``` npm run grab -- --site=osn.com --lang=ar > grab > npx tsx scripts/commands/epg/grab.ts --site=osn.com --lang=ar starting... config: output: guide.xml maxConnections: 1 gzip: false site: osn.com lang: ar loading channels... found 59 channel(s) run #1: [1/118] osn.com (ar) - DWR - Nov 27, 2024 (24 programs) [2/118] osn.com (ar) - DWR - Nov 28, 2024 (24 programs) ... [117/118] osn.com (ar) - OSNYahalaBilArabi.ae - Nov 28, 2024 (29 programs) [118/118] osn.com (ar) - TheFilipinoChannelMiddleEast.us - Nov 28, 2024 (30 programs) saving to "guide.xml"... done in 00h 01m 23s ``` Signed-off-by: Toha <tohenk@yahoo.com>
This commit is contained in:
parent
78dad4cfb4
commit
1d3008d144
5 changed files with 470 additions and 102 deletions
|
@ -1,15 +1,17 @@
|
|||
const { parser, url, request } = require('./osn.com.config.js')
|
||||
const { parser, url, request } = require('./osn.com.config')
|
||||
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)
|
||||
|
||||
const date = dayjs.utc('2021-10-24', 'YYYY-MM-DD').startOf('d')
|
||||
const channelAR = { site_id: 'AAN', xmltv_id: 'AlAanTV.ae', lang: 'ar' }
|
||||
const channelEN = { site_id: 'AAN', xmltv_id: 'AlAanTV.ae', lang: 'en' }
|
||||
const content =
|
||||
'[{"IsPlaying":"0","Durationtime":null,"StartMinute":0,"EndMinute":0,"EmptyDivWidth":1152,"TotalDivWidth":576,"IsTodayDate":false,"IsLastRow":false,"StartDateTime":"24 Oct 2021, 22:00","EndDateTime":"\\/Date(-62135596800000)\\/","Title":"Al Aan TV","Arab_Title":"تلفزيون الآن","GenreEnglishName":null,"GenreArabicName":null,"ChannelNumber":140,"ChannelCode":"AAN","Duration":"\\/Date(-62135596800000)\\/","Showtime":"\\/Date(-62135596800000)\\/","EpisodeId":738257,"ProgramType":null,"EPGUNIQID":"AAN202110271800738257"}]'
|
||||
const date = dayjs.utc('2024-11-27', 'YYYY-MM-DD').startOf('d')
|
||||
const channelAR = { site_id: 'FTF', xmltv_id: 'Fatafeat.ae', lang: 'ar' }
|
||||
const channelEN = { site_id: 'FTF', xmltv_id: 'Fatafeat.ae', lang: 'en' }
|
||||
const content = fs.readFileSync(path.join(__dirname, '__data__', 'content.json'))
|
||||
|
||||
it('can generate valid request headers', () => {
|
||||
const result = request.headers({ channel: channelAR, date })
|
||||
|
@ -21,32 +23,38 @@ it('can generate valid request headers', () => {
|
|||
it('can generate valid url', () => {
|
||||
const result = url({ channel: channelAR, date })
|
||||
expect(result).toBe(
|
||||
'https://www.osn.com/api/TVScheduleWebService.asmx/GetTVChannelsProgramTimeTable?newDate=10%2F24%2F2021&selectedCountry=AE&channelCode=AAN&isMobile=false&hoursForMobile=0'
|
||||
'https://www.osn.com/api/TVScheduleWebService.asmx/time?dt=11%2F27%2F2024&co=AE&ch=FTF&mo=false&hr=0'
|
||||
)
|
||||
})
|
||||
|
||||
it('can parse response (ar)', () => {
|
||||
const result = parser({ date, channel: channelAR, content })
|
||||
expect(result).toMatchObject([
|
||||
{
|
||||
start: 'Sun, 24 Oct 2021 18:00:00 GMT',
|
||||
stop: 'Sun, 24 Oct 2021 20:00:00 GMT',
|
||||
title: 'تلفزيون الآن',
|
||||
category: null
|
||||
}
|
||||
])
|
||||
.map(a => {
|
||||
a.start = a.start.toJSON()
|
||||
a.stop = a.stop.toJSON()
|
||||
return a
|
||||
})
|
||||
expect(result.length).toBe(29)
|
||||
expect(result[1]).toMatchObject({
|
||||
start: '2024-11-26T20:50:00.000Z',
|
||||
stop: '2024-11-26T21:45:00.000Z',
|
||||
title: 'بيت الحلويات: الحلقة 3',
|
||||
})
|
||||
})
|
||||
|
||||
it('can parse response (en)', () => {
|
||||
const result = parser({ date, channel: channelEN, content })
|
||||
expect(result).toMatchObject([
|
||||
{
|
||||
start: 'Sun, 24 Oct 2021 18:00:00 GMT',
|
||||
stop: 'Sun, 24 Oct 2021 20:00:00 GMT',
|
||||
title: 'Al Aan TV',
|
||||
category: null
|
||||
}
|
||||
])
|
||||
.map(a => {
|
||||
a.start = a.start.toJSON()
|
||||
a.stop = a.stop.toJSON()
|
||||
return a
|
||||
})
|
||||
expect(result.length).toBe(29)
|
||||
expect(result[1]).toMatchObject({
|
||||
start: '2024-11-26T20:50:00.000Z',
|
||||
stop: '2024-11-26T21:45:00.000Z',
|
||||
title: 'House Of Desserts: Episode 3',
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue