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
|
@ -26,22 +26,25 @@ module.exports = {
|
|||
if (content) {
|
||||
const dates = []
|
||||
const $ = cheerio.load(content)
|
||||
const parent = $(`.tv-scheme-chanel-header img[src*="chanel-${channel.site_id}.png"]`)
|
||||
.parents('div')
|
||||
const parent = $(
|
||||
`.tv-scheme-chanel-header img[src*="chanel-${channel.site_id}.png"]`
|
||||
).parents('div')
|
||||
parent
|
||||
.siblings('.tv-scheme-days')
|
||||
.find('a').toArray()
|
||||
.forEach(el => {
|
||||
const a = $(el)
|
||||
const dt = a.find('span:nth-child(3)').text()
|
||||
dates.push(dayjs(dt + date.year(), 'DD.MM.YYYY'))
|
||||
})
|
||||
.find('a')
|
||||
.toArray()
|
||||
.forEach(el => {
|
||||
const a = $(el)
|
||||
const dt = a.find('span:nth-child(3)').text()
|
||||
dates.push(dayjs(dt + date.year(), 'DD.MM.YYYY'))
|
||||
})
|
||||
parent
|
||||
.siblings('.tv-scheme-new-slider-wrapper')
|
||||
.find('.tv-scheme-new-slider-item').toArray()
|
||||
.forEach((el, i) => {
|
||||
programs.push(...parseSchedules($(el), dates[i], module.exports.tz))
|
||||
})
|
||||
.find('.tv-scheme-new-slider-item')
|
||||
.toArray()
|
||||
.forEach((el, i) => {
|
||||
programs.push(...parseSchedules($(el), dates[i], module.exports.tz))
|
||||
})
|
||||
programs.forEach((s, i) => {
|
||||
if (i < programs.length - 2) {
|
||||
s.stop = programs[i + 1].start
|
||||
|
@ -51,8 +54,11 @@ module.exports = {
|
|||
})
|
||||
}
|
||||
|
||||
return programs
|
||||
.filter(p => p.start.format('YYYY-MM-DD') === expectedDate || p.stop.format('YYYY-MM-DD') === expectedDate)
|
||||
return programs.filter(
|
||||
p =>
|
||||
p.start.format('YYYY-MM-DD') === expectedDate ||
|
||||
p.stop.format('YYYY-MM-DD') === expectedDate
|
||||
)
|
||||
},
|
||||
async channels() {
|
||||
const channels = []
|
||||
|
@ -81,7 +87,9 @@ module.exports = {
|
|||
const $ = cheerio.load(data)
|
||||
const items = $('.tv-scheme-chanel-header img').toArray()
|
||||
for (const item of items) {
|
||||
const [, id] = $(item).attr('src').match(/chanel-([a-z0-9]+)\.png/) || [null, null]
|
||||
const [, id] = $(item)
|
||||
.attr('src')
|
||||
.match(/chanel-([a-z0-9]+)\.png/) || [null, null]
|
||||
if (id) {
|
||||
channels.push({
|
||||
lang: this.lang,
|
||||
|
@ -99,7 +107,8 @@ module.exports = {
|
|||
function parseSchedules($s, date, tz) {
|
||||
const schedules = []
|
||||
const $ = $s._make
|
||||
$s.find('.slider-content').toArray()
|
||||
$s.find('.slider-content')
|
||||
.toArray()
|
||||
.forEach(el => {
|
||||
schedules.push(parseSchedule($(el), date, tz))
|
||||
})
|
||||
|
|
|
@ -32,12 +32,12 @@ it('can parse response', () => {
|
|||
stop: '2024-12-07T05:00:00.000Z',
|
||||
title: 'EVROPSKO PRVENSTVO Ž',
|
||||
description: 'Francuska - Crna Gora',
|
||||
category: 'Rukomet',
|
||||
category: 'Rukomet'
|
||||
})
|
||||
expect(result[8]).toMatchObject({
|
||||
start: '2024-12-07T11:00:00.000Z',
|
||||
stop: '2024-12-07T11:05:00.000Z',
|
||||
title: 'Arena News',
|
||||
title: 'Arena News'
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue