mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 16:40:07 -04:00
Fix linter issues in sites/
This commit is contained in:
parent
d6d20b6413
commit
5df982bb7c
129 changed files with 3316 additions and 3226 deletions
|
@ -11,9 +11,7 @@ dayjs.extend(timezone)
|
|||
dayjs.extend(utc)
|
||||
dayjs.extend(customParseFormat)
|
||||
|
||||
doFetch
|
||||
.setCheckResult(false)
|
||||
.setDebugger(debug)
|
||||
doFetch.setCheckResult(false).setDebugger(debug)
|
||||
|
||||
const tz = 'Asia/Riyadh'
|
||||
const defaultHeaders = {
|
||||
|
@ -47,7 +45,7 @@ module.exports = {
|
|||
headers: {
|
||||
...defaultHeaders,
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
cookie: cookies[channel.lang],
|
||||
cookie: cookies[channel.lang]
|
||||
}
|
||||
}
|
||||
queues.push({ i: item, url, params })
|
||||
|
@ -61,7 +59,7 @@ module.exports = {
|
|||
},
|
||||
async channels({ lang = 'en' }) {
|
||||
const result = await axios
|
||||
.get(`https://rotana.net/api/channels`)
|
||||
.get('https://rotana.net/api/channels')
|
||||
.then(response => response.data)
|
||||
.catch(console.error)
|
||||
|
||||
|
@ -88,34 +86,37 @@ function parseProgram(item, result) {
|
|||
item.description = desc
|
||||
}
|
||||
}
|
||||
break;
|
||||
break
|
||||
case 'Element':
|
||||
if (el.name === 'span') {
|
||||
const [k, v] = $(el).text().split(':').map(a => a.trim())
|
||||
const [k, v] = $(el)
|
||||
.text()
|
||||
.split(':')
|
||||
.map(a => a.trim())
|
||||
switch (k) {
|
||||
case 'Category':
|
||||
case 'التصنيف':
|
||||
item.category = v;
|
||||
break;
|
||||
item.category = v
|
||||
break
|
||||
case 'Country':
|
||||
case 'البلد':
|
||||
item.country = v;
|
||||
break;
|
||||
item.country = v
|
||||
break
|
||||
case 'Director':
|
||||
case 'المخرج':
|
||||
item.director = v;
|
||||
break;
|
||||
item.director = v
|
||||
break
|
||||
case 'Language':
|
||||
case 'اللغة':
|
||||
item.language = v;
|
||||
break;
|
||||
item.language = v
|
||||
break
|
||||
case 'Release Year':
|
||||
case 'سنة الإصدار':
|
||||
item.date = v;
|
||||
break;
|
||||
item.date = v
|
||||
break
|
||||
}
|
||||
}
|
||||
break;
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +143,9 @@ function parseItems(content, date) {
|
|||
const heading = top.find('.iq-accordion-title .big-title')
|
||||
if (heading.length) {
|
||||
const progId = top.attr('id')
|
||||
const title = heading.find('span:eq(1)').text()
|
||||
const title = heading
|
||||
.find('span:eq(1)')
|
||||
.text()
|
||||
.split('\n')
|
||||
.map(a => a.trim())
|
||||
.join(' ')
|
||||
|
@ -151,7 +154,7 @@ function parseItems(content, date) {
|
|||
items.push({
|
||||
program: progId.substr(progId.indexOf('-') + 1),
|
||||
title: title ? title.trim() : title,
|
||||
start: `${y}-${m}-${d} ${time.trim()}`,
|
||||
start: `${y}-${m}-${d} ${time.trim()}`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ const channel = {
|
|||
}
|
||||
const channelAr = Object.assign({}, channel, { lang: 'ar' })
|
||||
|
||||
axios.get.mockImplementation((url, opts) => {
|
||||
axios.get.mockImplementation(url => {
|
||||
if (url === 'https://rotana.net/en/streams?channel=439&itemId=736970') {
|
||||
return Promise.resolve({
|
||||
data: fs.readFileSync(path.resolve(__dirname, '__data__/program_en.html'))
|
||||
|
@ -52,11 +52,13 @@ it('can generate valid arabic url', () => {
|
|||
})
|
||||
|
||||
it('can parse english response', async () => {
|
||||
const result = (await parser({
|
||||
channel,
|
||||
date,
|
||||
content: fs.readFileSync(path.join(__dirname, '/__data__/content_en.html'))
|
||||
})).map(a => {
|
||||
const result = (
|
||||
await parser({
|
||||
channel,
|
||||
date,
|
||||
content: fs.readFileSync(path.join(__dirname, '/__data__/content_en.html'))
|
||||
})
|
||||
).map(a => {
|
||||
a.start = a.start.toJSON()
|
||||
a.stop = a.stop.toJSON()
|
||||
return a
|
||||
|
@ -69,17 +71,20 @@ it('can parse english response', async () => {
|
|||
title: 'Khiyana Mashroua',
|
||||
description:
|
||||
'Hisham knows that his father has given all his wealth to his elder brother. This leads him to plan to kill his brother to make it look like a defense of honor, which he does by killing his wife along...',
|
||||
image: 'https://s3.eu-central-1.amazonaws.com/rotana.website/spider_storage/1398X1000/1687084565',
|
||||
image:
|
||||
'https://s3.eu-central-1.amazonaws.com/rotana.website/spider_storage/1398X1000/1687084565',
|
||||
category: 'Movie'
|
||||
})
|
||||
})
|
||||
|
||||
it('can parse arabic response', async () => {
|
||||
const result = (await parser({
|
||||
channel: channelAr,
|
||||
date,
|
||||
content: fs.readFileSync(path.join(__dirname, '/__data__/content_ar.html'))
|
||||
})).map(a => {
|
||||
const result = (
|
||||
await parser({
|
||||
channel: channelAr,
|
||||
date,
|
||||
content: fs.readFileSync(path.join(__dirname, '/__data__/content_ar.html'))
|
||||
})
|
||||
).map(a => {
|
||||
a.start = a.start.toJSON()
|
||||
a.stop = a.stop.toJSON()
|
||||
return a
|
||||
|
@ -92,7 +97,8 @@ it('can parse arabic response', async () => {
|
|||
title: 'خيانة مشروعة',
|
||||
description:
|
||||
'يعلم هشام البحيري أن والده قد حرمه من الميراث، ووهب كل ثروته لشقيقه اﻷكبر، وهو ما يدفعه لتدبير جريمة قتل شقيقه لتبدو وكأنها دفاع عن الشرف، وذلك حين يقتل هشام زوجته مع شقيقه.',
|
||||
image: 'https://s3.eu-central-1.amazonaws.com/rotana.website/spider_storage/1398X1000/1687084565',
|
||||
image:
|
||||
'https://s3.eu-central-1.amazonaws.com/rotana.website/spider_storage/1398X1000/1687084565',
|
||||
category: 'فيلم'
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue