Replace LF endings with CRLF

This commit is contained in:
freearhey
2025-07-31 22:29:01 +03:00
parent 17e3b4ddda
commit 29aa427923
379 changed files with 29332 additions and 29332 deletions

View File

@@ -1,73 +1,73 @@
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
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 country = 'AE'
const tz = 'Asia/Dubai'
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`
},
request: {
headers({ channel }) {
return {
Referer: `https://www.osn.com/${channel.lang}-${country.toLowerCase()}/watch/tv-schedule`
}
}
},
parser({ content, channel }) {
const programs = []
const items = JSON.parse(content) || []
if (Array.isArray(items)) {
for (const item of items) {
const title = channel.lang === 'ar' ? item.Arab_Title : item.Title
const start = dayjs.tz(item.StartDateTime, 'DD MMM YYYY, HH:mm', tz)
const duration = parseInt(item.TotalDivWidth / 4.8)
const stop = start.add(duration, 'm')
programs.push({ title, start, stop })
}
}
return programs
},
async channels({ lang = 'ar' }) {
const result = {}
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}`
)
.then(response => response.data)
.catch(console.error)
if (Array.isArray(channels)) {
for (const ch of channels) {
if (result[ch.channelCode] === undefined) {
result[ch.channelCode] = {
lang,
site_id: ch.channelCode,
name: ch.channeltitle
}
}
}
}
}
return Object.values(result)
}
}
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
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 country = 'AE'
const tz = 'Asia/Dubai'
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`
},
request: {
headers({ channel }) {
return {
Referer: `https://www.osn.com/${channel.lang}-${country.toLowerCase()}/watch/tv-schedule`
}
}
},
parser({ content, channel }) {
const programs = []
const items = JSON.parse(content) || []
if (Array.isArray(items)) {
for (const item of items) {
const title = channel.lang === 'ar' ? item.Arab_Title : item.Title
const start = dayjs.tz(item.StartDateTime, 'DD MMM YYYY, HH:mm', tz)
const duration = parseInt(item.TotalDivWidth / 4.8)
const stop = start.add(duration, 'm')
programs.push({ title, start, stop })
}
}
return programs
},
async channels({ lang = 'ar' }) {
const result = {}
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}`
)
.then(response => response.data)
.catch(console.error)
if (Array.isArray(channels)) {
for (const ch of channels) {
if (result[ch.channelCode] === undefined) {
result[ch.channelCode] = {
lang,
site_id: ch.channelCode,
name: ch.channeltitle
}
}
}
}
}
return Object.values(result)
}
}

View File

@@ -1,61 +1,61 @@
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('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 })
expect(result).toMatchObject({
Referer: 'https://www.osn.com/ar-ae/watch/tv-schedule'
})
})
it('can generate valid url', () => {
const result = url({ channel: channelAR, date })
expect(result).toBe(
'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 }).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 }).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', () => {
const result = parser({ date, channel: channelAR, content: '[]' })
expect(result).toMatchObject([])
})
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('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 })
expect(result).toMatchObject({
Referer: 'https://www.osn.com/ar-ae/watch/tv-schedule'
})
})
it('can generate valid url', () => {
const result = url({ channel: channelAR, date })
expect(result).toBe(
'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 }).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 }).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', () => {
const result = parser({ date, channel: channelAR, content: '[]' })
expect(result).toMatchObject([])
})