mirror of
https://github.com/iptv-org/epg
synced 2025-12-16 02:16:40 -05:00
1
sites/roya-tv.com/__data__/content.json
Normal file
1
sites/roya-tv.com/__data__/content.json
Normal file
File diff suppressed because one or more lines are too long
1
sites/roya-tv.com/__data__/no_content.json
Normal file
1
sites/roya-tv.com/__data__/no_content.json
Normal file
@@ -0,0 +1 @@
|
||||
{"status":true,"message":"\u062a\u0645 \u0625\u062d\u0636\u0627\u0631 \u0627\u0644\u0628\u064a\u0627\u0646\u0627\u062a \u0628\u0646\u062c\u0627\u062d ","CurrentItem":{"start_time":"23:30:00","end_time":"00:00:00","currenttime":"23:41:50","shareUrl":"https:\/\/roya.tv\/live-stream\/1","start_timestamp":1754857800,"end_timestamp":1754859600,"duration":"00:30:00","nowShowing":true,"live":true,"program_id":1512,"name":"\u0627\u0644\u0639\u0631\u0628\u062c\u064a - \u0627\u0644\u062c\u0632\u0621 \u0627\u0644\u0623\u0648\u0644","thumbnail_web":"https:\/\/backend.roya-tv.com\/imagechanger\/Size03Q40R169\/images\/programs\/1511\/1tJPeaXLCcoZiUy.webp","thumbnail_mob":"https:\/\/backend.roya-tv.com\/imagechanger\/Size03Q40R169M\/images\/programs\/1511\/2du8FlygPajdX1G.webp","program_type":2,"description":"\u062a\u062f\u0648\u0631 \u0642\u0635\u0629 \u0627\u0644\u0645\u0633\u0644\u0633\u0644 \u062d\u0648\u0644 \u0639\u0628\u062f\u0648 \u0627\u0644\u0630\u064a \u064a\u0639\u0645\u0644 \u0643\u0642\u0627\u0626\u062f \u0644\u0644\u0639\u0631\u0628\u0627\u062a \u0627\u0644\u062a\u064a \u062a\u062c\u064f\u0631\u0647\u0627 \u0627\u0644\u0623\u062d\u0635\u0646\u0629 (\u0639\u0631\u0628\u062c\u064a) \u0648\u0647\u064a \u062d\u0631\u0641\u0629 \u062b\u0627\u0628\u062a\u0629 \u0641\u064a \u062f\u0645\u0634\u0642\u060c \u0648\u062d\u064a\u0646\u0645\u0627 \u064a\u0642\u0639 \u0641\u064a \u062d\u0628 \u0641\u062a\u0627\u0629 \u062a\u064f\u062f\u0639\u0649 \u0646\u0627\u062c\u064a\u0629 \u0648\u062a\u0631\u0641\u0636\u0647\u060c \u064a\u0641\u0639\u0644 \u0639\u0628\u062f\u0648 \u0627\u0644\u0645\u0633\u062a\u062d\u064a\u0644 \u0644\u0644\u0648\u0635\u0648\u0644 \u0625\u0644\u0649 \u0642\u0644\u0628\u0647\u0627 \u0648\u0627\u0644\u062a\u0642\u0631\u0628 \u0645\u0646\u0647\u0627.\r\n\u0627\u0644\u0645\u0633\u0644\u0633\u0644 \u0645\u0646 \ufe87\ufea7\ufeae\u0627\ufe9d \u0633\u064a\u0641 \u0627\u0644\u062f\u064a\u0646 \u0627\u0644\u0633\u0628\u064a\u0639\u064a\r\n\u0637\u0627\u0642\u0645 \u0627\u0644\u0639\u0645\u0644:\r\n\r\n\u0628\u0627\u0633\u0645 \u064a\u0627\u062e\u0648\u0631\r\n\u0633\u0644\u0648\u0645 \u062d\u062f\u0627\u062f\r\n\u0646\u0627\u062f\u064a\u0646 \u062e\u0648\u0631\u064a\r\n\u0637\u0644\u0627\u0644 \u0645\u0627\u0631\u062f\u064a\u0646\u064a\r\n\u0641\u0627\u0631\u0633 \u064a\u0627\u063a\u064a\r\n\u062f\u064a\u0645\u0629 \u0642\u0646\u062f\u0644\u0641\u062a \r\n","reachable":true,"isShowingNow":true,"isNotRelatedRoyaTv":false,"plus":true},"data":[{"day":"\u0627\u0644\u064a\u0648\u0645","day_number":0,"date":"2025-08-10","channel":[]},{"day":"\u0627\u0644\u0625\u062b\u0646\u064a\u0646","day_number":1,"date":"2025-08-11","channel":[]},{"day":"\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621","day_number":2,"date":"2025-08-12","channel":[]},{"day":"\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621","day_number":3,"date":"2025-08-13","channel":[]},{"day":"\u0627\u0644\u062e\u0645\u064a\u0633","day_number":4,"date":"2025-08-14","channel":[]},{"day":"\u0627\u0644\u062c\u0645\u0639\u0629","day_number":5,"date":"2025-08-15","channel":[]},{"day":"\u0627\u0644\u0633\u0628\u062a","day_number":6,"date":"2025-08-16","channel":[]}]}
|
||||
21
sites/roya-tv.com/readme.md
Normal file
21
sites/roya-tv.com/readme.md
Normal file
@@ -0,0 +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
|
||||
```
|
||||
13
sites/roya-tv.com/roya-tv.com.channels.xml
Normal file
13
sites/roya-tv.com/roya-tv.com.channels.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<channels>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="" site_id="1">Roya TV</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="" site_id="2">Roya Drama</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="" site_id="3">Roya Comedy</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="" site_id="4">Roya Kitchen</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="" site_id="14">Roya Kids</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="" site_id="21">Roya News</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="" site_id="25">Roya Music</channel>
|
||||
<channel site="roya-tv.com" lang="ar" xmltv_id="" site_id="27">Roya Kids Songs</channel>
|
||||
<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>
|
||||
</channels>
|
||||
66
sites/roya-tv.com/roya-tv.com.config.js
Normal file
66
sites/roya-tv.com/roya-tv.com.config.js
Normal file
@@ -0,0 +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 []
|
||||
}
|
||||
}
|
||||
64
sites/roya-tv.com/roya-tv.com.test.js
Normal file
64
sites/roya-tv.com/roya-tv.com.test.js
Normal file
@@ -0,0 +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([])
|
||||
})
|
||||
Reference in New Issue
Block a user