Fix linter issues in sites/

This commit is contained in:
freearhey 2025-01-01 12:27:22 +03:00
parent d6d20b6413
commit 5df982bb7c
129 changed files with 3316 additions and 3226 deletions

View file

@ -5,7 +5,12 @@ const timezone = require('dayjs/plugin/timezone')
dayjs.extend(utc)
dayjs.extend(timezone)
const packages = { 'OSNTV CONNECT': 3720, 'OSNTV PRIME': 3733, 'ALFA': 1281, 'OSN PINOY PLUS EXTRA': 3519 }
const packages = {
'OSNTV CONNECT': 3720,
'OSNTV PRIME': 3733,
ALFA: 1281,
'OSN PINOY PLUS EXTRA': 3519
}
const country = 'AE'
const tz = 'Asia/Dubai'
@ -13,11 +18,9 @@ module.exports = {
site: 'osn.com',
days: 2,
url({ channel, date }) {
return `https://www.osn.com/api/TVScheduleWebService.asmx/time?dt=${
encodeURIComponent(date.format('MM/DD/YYYY'))
}&co=${country}&ch=${
channel.site_id
}&mo=false&hr=0`
return `https://www.osn.com/api/TVScheduleWebService.asmx/time?dt=${encodeURIComponent(
date.format('MM/DD/YYYY')
)}&co=${country}&ch=${channel.site_id}&mo=false&hr=0`
},
request: {
headers({ channel }) {
@ -46,7 +49,9 @@ module.exports = {
const axios = require('axios')
for (const pkg of Object.values(packages)) {
const channels = await axios
.get(`https://www.osn.com/api/tvchannels.ashx?culture=en-US&packageId=${pkg}&country=${country}`)
.get(
`https://www.osn.com/api/tvchannels.ashx?culture=en-US&packageId=${pkg}&country=${country}`
)
.then(response => response.data)
.catch(console.error)

View file

@ -28,32 +28,30 @@ it('can generate valid url', () => {
})
it('can parse response (ar)', () => {
const result = parser({ date, channel: channelAR, content })
.map(a => {
a.start = a.start.toJSON()
a.stop = a.stop.toJSON()
return a
})
const result = parser({ date, channel: channelAR, content }).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',
title: 'بيت الحلويات: الحلقة 3'
})
})
it('can parse response (en)', () => {
const result = parser({ date, channel: channelEN, content })
.map(a => {
a.start = a.start.toJSON()
a.stop = a.stop.toJSON()
return a
})
const result = parser({ date, channel: channelEN, content }).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',
title: 'House Of Desserts: Episode 3'
})
})