mirror of
https://github.com/iptv-org/epg
synced 2026-05-01 06:56:59 -04:00
Replace LF line endings with CRLF
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
# roya-tv.com
|
||||
|
||||
https://en.roya.tv/live-stream
|
||||
|
||||
### Download the guide
|
||||
|
||||
```sh
|
||||
npm run grab --- --site=roya-tv.com
|
||||
```
|
||||
|
||||
### Update channel list
|
||||
|
||||
```sh
|
||||
npm run channels:parse --- --config=./sites/roya-tv.com/roya-tv.com.config.js --output=./sites/roya-tv.com/roya-tv.com.channels.xml
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
```sh
|
||||
npm test --- roya-tv.com
|
||||
```
|
||||
# roya-tv.com
|
||||
|
||||
https://en.roya.tv/live-stream
|
||||
|
||||
### Download the guide
|
||||
|
||||
```sh
|
||||
npm run grab --- --site=roya-tv.com
|
||||
```
|
||||
|
||||
### Update channel list
|
||||
|
||||
```sh
|
||||
npm run channels:parse --- --config=./sites/roya-tv.com/roya-tv.com.config.js --output=./sites/roya-tv.com/roya-tv.com.channels.xml
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
```sh
|
||||
npm test --- roya-tv.com
|
||||
```
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<channels>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="" site_id="38">رؤيا فلسطين</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="" site_id="48">Roya Sport</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="RoyaComedy.jo" site_id="3">Roya Comedy</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="RoyaDrama.jo" site_id="2">Roya Drama</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="RoyaKids.jo" site_id="14">Roya Kids</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="RoyaKidsSongs.jo" site_id="27">Roya Kids Songs</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="RoyaKitchen.jo" site_id="4">Roya Kitchen</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="RoyaMusic.jo" site_id="25">Roya Music</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="RoyaNews.jo" site_id="21">Roya News</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="RoyaTV.jo" site_id="1">Roya TV</channel>
|
||||
</channels>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<channels>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="" site_id="38">رؤيا فلسطين</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="" site_id="48">Roya Sport</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="RoyaComedy.jo" site_id="3">Roya Comedy</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="RoyaDrama.jo" site_id="2">Roya Drama</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="RoyaKids.jo" site_id="14">Roya Kids</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="RoyaKidsSongs.jo" site_id="27">Roya Kids Songs</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="RoyaKitchen.jo" site_id="4">Roya Kitchen</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="RoyaMusic.jo" site_id="25">Roya Music</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="RoyaNews.jo" site_id="21">Roya News</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="RoyaTV.jo" site_id="1">Roya TV</channel>
|
||||
</channels>
|
||||
|
||||
@@ -1,66 +1,66 @@
|
||||
const axios = require('axios')
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const timezone = require('dayjs/plugin/timezone')
|
||||
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
|
||||
module.exports = {
|
||||
site: 'roya-tv.com',
|
||||
days: 2,
|
||||
request: {
|
||||
cache: {
|
||||
ttl: 60 * 60 * 1000 // 1 hour
|
||||
}
|
||||
},
|
||||
url({ date }) {
|
||||
const diff = date.diff(dayjs.utc().startOf('d'), 'd')
|
||||
|
||||
return `https://backend.roya.tv/api/v01/channels/schedule-pagination?day_number=${diff}`
|
||||
},
|
||||
parser({ content, date, channel }) {
|
||||
const items = parseItems(content, date, channel)
|
||||
|
||||
return items.map(item => {
|
||||
return {
|
||||
title: item.name,
|
||||
description: item.description,
|
||||
image: item.thumbnail_web,
|
||||
start: dayjs.unix(item.start_timestamp),
|
||||
stop: dayjs.unix(item.end_timestamp)
|
||||
}
|
||||
})
|
||||
},
|
||||
async channels() {
|
||||
const data = await axios
|
||||
.get('https://backend.roya.tv/api/v01/channels/schedule-pagination?day_number=0')
|
||||
.then(r => r.data)
|
||||
.catch(console.error)
|
||||
|
||||
return data.data[0].channel.map(channel => {
|
||||
return {
|
||||
site_id: channel.id,
|
||||
name: channel.title,
|
||||
lang: 'ar'
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function parseItems(content, date, channel) {
|
||||
const dateString = date.format('YYYY-MM-DD')
|
||||
|
||||
try {
|
||||
const data = JSON.parse(content)
|
||||
if (!data || !Array.isArray(data.data)) return []
|
||||
const dayData = data.data.find(item => item.date === dateString)
|
||||
if (!dayData || !Array.isArray(dayData.channel)) return []
|
||||
const channelData = dayData.channel.find(item => item.id == channel.site_id)
|
||||
if (!channelData || !Array.isArray(channelData.programs)) return []
|
||||
|
||||
return channelData.programs
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
}
|
||||
const axios = require('axios')
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const timezone = require('dayjs/plugin/timezone')
|
||||
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
|
||||
module.exports = {
|
||||
site: 'roya-tv.com',
|
||||
days: 2,
|
||||
request: {
|
||||
cache: {
|
||||
ttl: 60 * 60 * 1000 // 1 hour
|
||||
}
|
||||
},
|
||||
url({ date }) {
|
||||
const diff = date.diff(dayjs.utc().startOf('d'), 'd')
|
||||
|
||||
return `https://backend.roya.tv/api/v01/channels/schedule-pagination?day_number=${diff}`
|
||||
},
|
||||
parser({ content, date, channel }) {
|
||||
const items = parseItems(content, date, channel)
|
||||
|
||||
return items.map(item => {
|
||||
return {
|
||||
title: item.name,
|
||||
description: item.description,
|
||||
image: item.thumbnail_web,
|
||||
start: dayjs.unix(item.start_timestamp),
|
||||
stop: dayjs.unix(item.end_timestamp)
|
||||
}
|
||||
})
|
||||
},
|
||||
async channels() {
|
||||
const data = await axios
|
||||
.get('https://backend.roya.tv/api/v01/channels/schedule-pagination?day_number=0')
|
||||
.then(r => r.data)
|
||||
.catch(console.error)
|
||||
|
||||
return data.data[0].channel.map(channel => {
|
||||
return {
|
||||
site_id: channel.id,
|
||||
name: channel.title,
|
||||
lang: 'ar'
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function parseItems(content, date, channel) {
|
||||
const dateString = date.format('YYYY-MM-DD')
|
||||
|
||||
try {
|
||||
const data = JSON.parse(content)
|
||||
if (!data || !Array.isArray(data.data)) return []
|
||||
const dayData = data.data.find(item => item.date === dateString)
|
||||
if (!dayData || !Array.isArray(dayData.channel)) return []
|
||||
const channelData = dayData.channel.find(item => item.id == channel.site_id)
|
||||
if (!channelData || !Array.isArray(channelData.programs)) return []
|
||||
|
||||
return channelData.programs
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,64 +1,64 @@
|
||||
const { parser, url } = require('./roya-tv.com.config.js')
|
||||
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 channel = { site_id: '3' }
|
||||
const date = dayjs.utc('2025-08-13', 'YYYY-MM-DD').startOf('d')
|
||||
|
||||
it('can generate valid url for today', () => {
|
||||
const date = dayjs.utc().startOf('d')
|
||||
expect(url({ date })).toBe(
|
||||
'https://backend.roya.tv/api/v01/channels/schedule-pagination?day_number=0'
|
||||
)
|
||||
})
|
||||
|
||||
it('can generate valid url for tomorrow', () => {
|
||||
const date = dayjs.utc().startOf('d').add(1, 'd')
|
||||
expect(url({ date })).toBe(
|
||||
'https://backend.roya.tv/api/v01/channels/schedule-pagination?day_number=1'
|
||||
)
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
|
||||
|
||||
let results = parser({ content, channel, date })
|
||||
results = results.map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results.length).toBe(52)
|
||||
expect(results[0]).toMatchObject({
|
||||
title: 'فلانتينو',
|
||||
description:
|
||||
'نور عبد الحميد، المعروف بـ (فلانتينو)، وزوجته عفاف، يمتلكان سلسلة مدارس باسم "مدارس فلانتينو". بسبب سيطرتهما وقوتهما، تنشأ بينهما العديد من الخلافات خلال أحداث المسلسل، ومن هنا تنطلق المغامرات والمفاجآت.',
|
||||
image:
|
||||
'https://backend.roya-tv.com/imagechanger/Size03Q40R169/images/programs/1345/vJKYA3DfsDQf9QA.webp',
|
||||
start: '2025-08-12T21:00:00.000Z',
|
||||
stop: '2025-08-12T21:36:11.000Z'
|
||||
})
|
||||
expect(results[51]).toMatchObject({
|
||||
title: 'الخربة',
|
||||
description:
|
||||
'يسرد مسلسل "الخربة" حكاية حياة عائلتين كبيرتين، بو قعقور بقيادة بو نمر (دريد لحام)، وبو مالحة بقيادة بو نايف (رشيد عساف)، \nحيث تتنافس كل عائلة على إزعاج الأخرى في أجواء كوميدية ساخرة.',
|
||||
image:
|
||||
'https://backend.roya-tv.com/imagechanger/Size03Q40R169/images/programs/517/3ZFod064OkM0GfO.jpg',
|
||||
start: '2025-08-13T20:40:19.000Z',
|
||||
stop: '2025-08-13T21:00:00.000Z'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/no_content.json'))
|
||||
const results = parser({ content, channel, date })
|
||||
|
||||
expect(results).toMatchObject([])
|
||||
})
|
||||
const { parser, url } = require('./roya-tv.com.config.js')
|
||||
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 channel = { site_id: '3' }
|
||||
const date = dayjs.utc('2025-08-13', 'YYYY-MM-DD').startOf('d')
|
||||
|
||||
it('can generate valid url for today', () => {
|
||||
const date = dayjs.utc().startOf('d')
|
||||
expect(url({ date })).toBe(
|
||||
'https://backend.roya.tv/api/v01/channels/schedule-pagination?day_number=0'
|
||||
)
|
||||
})
|
||||
|
||||
it('can generate valid url for tomorrow', () => {
|
||||
const date = dayjs.utc().startOf('d').add(1, 'd')
|
||||
expect(url({ date })).toBe(
|
||||
'https://backend.roya.tv/api/v01/channels/schedule-pagination?day_number=1'
|
||||
)
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
|
||||
|
||||
let results = parser({ content, channel, date })
|
||||
results = results.map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results.length).toBe(52)
|
||||
expect(results[0]).toMatchObject({
|
||||
title: 'فلانتينو',
|
||||
description:
|
||||
'نور عبد الحميد، المعروف بـ (فلانتينو)، وزوجته عفاف، يمتلكان سلسلة مدارس باسم "مدارس فلانتينو". بسبب سيطرتهما وقوتهما، تنشأ بينهما العديد من الخلافات خلال أحداث المسلسل، ومن هنا تنطلق المغامرات والمفاجآت.',
|
||||
image:
|
||||
'https://backend.roya-tv.com/imagechanger/Size03Q40R169/images/programs/1345/vJKYA3DfsDQf9QA.webp',
|
||||
start: '2025-08-12T21:00:00.000Z',
|
||||
stop: '2025-08-12T21:36:11.000Z'
|
||||
})
|
||||
expect(results[51]).toMatchObject({
|
||||
title: 'الخربة',
|
||||
description:
|
||||
'يسرد مسلسل "الخربة" حكاية حياة عائلتين كبيرتين، بو قعقور بقيادة بو نمر (دريد لحام)، وبو مالحة بقيادة بو نايف (رشيد عساف)، \nحيث تتنافس كل عائلة على إزعاج الأخرى في أجواء كوميدية ساخرة.',
|
||||
image:
|
||||
'https://backend.roya-tv.com/imagechanger/Size03Q40R169/images/programs/517/3ZFod064OkM0GfO.jpg',
|
||||
start: '2025-08-13T20:40:19.000Z',
|
||||
stop: '2025-08-13T21:00:00.000Z'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/no_content.json'))
|
||||
const results = parser({ content, channel, date })
|
||||
|
||||
expect(results).toMatchObject([])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user