Replaces icon with image

This commit is contained in:
freearhey 2024-06-24 16:49:35 +03:00
parent 0eaff54a31
commit bb6771f539
170 changed files with 428 additions and 351 deletions

View file

@ -11,7 +11,8 @@ dayjs.extend(utc)
dayjs.extend(customParseFormat)
const headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 OPR/104.0.0.0'
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 OPR/104.0.0.0'
}
const cookies = {}
@ -64,10 +65,10 @@ async function parseProgram(item, channel, options = {}) {
const top = item.find('.iq-accordion-block')
const info = top.find('.iq-accordion-title .big-title span')
if (info.length) {
const [ time, title ] = info.text().split('\n')
const [ d, m, y ] = item._date.split('-')
const [time, title] = info.text().split('\n')
const [d, m, y] = item._date.split('-')
const start = dayjs.tz(`${y}-${m}-${d} ${time.trim()}`, 'YYYY-MM-DD HH:mm', 'Asia/Riyadh')
let description, icon, stop
let description, image, stop
if (deep) {
const pid = top.attr('id').split('-')[1]
if (pid) {
@ -89,7 +90,7 @@ async function parseProgram(item, channel, options = {}) {
}
const img = $('.row > div > img')
if (img.length) {
icon = img.attr('src')
image = img.attr('src')
}
}
if (item._next) {
@ -102,7 +103,7 @@ async function parseProgram(item, channel, options = {}) {
return {
title: title?.trim(),
description: description?.trim(),
icon: icon,
image,
start: raw ? start : start?.toISOString(),
stop: raw ? stop : stop?.toISOString()
}
@ -125,7 +126,7 @@ function parseItems(content, date) {
if (lastId === expectedId) {
// set next item
if (result.length) {
result[result.length - 1]._next = $item;
result[result.length - 1]._next = $item
}
result.push($item)
} else if (result.length && !result[result.length - 1]._next) {
@ -146,4 +147,4 @@ function parseCookies(headers) {
})
}
return cookies.length ? cookies.join('; ') : null
}
}

View file

@ -63,7 +63,7 @@ it('can parse english response', async () => {
title: 'Katkout',
description:
'In a comic framework, the events of the film revolve around (Katkoot) Al-Saedi, whose aunt, the eldest of the Al-Saedi family, tries to force him to kill himself in order to ransom his family. A time...',
icon: 'https://imgsrv.rotana.net/spider_storage/1398X1000/1690882129.webp?w=450&fit=max'
image: 'https://imgsrv.rotana.net/spider_storage/1398X1000/1690882129.webp?w=450&fit=max'
})
})
@ -79,7 +79,7 @@ it('can parse arabic response', async () => {
title: 'كتكوت',
description:
'في إطار كوميدي تدور أحداث الفيلم، حول (كتكوت) الصعيدي الذي تحاول عمته كبيرة العائلة الصعيدية إجباره على تقديم نفسه للقتل ليفدي عائلته، ولكنه يهرب وتخطفه جهة أمنية لاكتشاف شبه كبير بينه وبين (يوسف خوري...',
icon: 'https://imgsrv.rotana.net/spider_storage/1398X1000/1690882129.webp?w=450&fit=max'
image: 'https://imgsrv.rotana.net/spider_storage/1398X1000/1690882129.webp?w=450&fit=max'
})
})