mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 17:10:07 -04:00
Fix pluto.tv linter issues
This commit is contained in:
parent
a89e26855b
commit
382d4a310e
4 changed files with 57 additions and 57 deletions
|
@ -1,50 +1,49 @@
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const timezone = require('dayjs/plugin/timezone')
|
const timezone = require('dayjs/plugin/timezone')
|
||||||
const axios = require('axios')
|
|
||||||
|
dayjs.extend(utc)
|
||||||
dayjs.extend(utc)
|
dayjs.extend(timezone)
|
||||||
dayjs.extend(timezone)
|
|
||||||
|
module.exports = {
|
||||||
module.exports = {
|
site: 'pluto.tv',
|
||||||
site: 'pluto.tv',
|
days: 3,
|
||||||
days: 3,
|
|
||||||
|
url: function ({ date, channel }) {
|
||||||
url: function ({ date, channel }) {
|
const channelId = channel.site_id
|
||||||
const channelId = channel.site_id
|
|
||||||
|
const localTimezone = dayjs.tz.guess()
|
||||||
const localTimezone = dayjs.tz.guess()
|
|
||||||
|
const startTime = dayjs(date).tz(localTimezone).startOf('day').toISOString()
|
||||||
const startTime = dayjs(date).tz(localTimezone).startOf('day').toISOString()
|
const endTime = dayjs(date).tz(localTimezone).add(this.days, 'day').endOf('day').toISOString()
|
||||||
const endTime = dayjs(date).tz(localTimezone).add(this.days, 'day').endOf('day').toISOString()
|
|
||||||
|
const generatedUrl = `https://api.pluto.tv/v2/channels/${channelId}?start=${startTime}&stop=${endTime}`
|
||||||
const generatedUrl = `https://api.pluto.tv/v2/channels/${channelId}?start=${startTime}&stop=${endTime}`
|
return generatedUrl
|
||||||
return generatedUrl
|
},
|
||||||
},
|
|
||||||
|
parser: function ({ content }) {
|
||||||
parser: function ({ content }) {
|
const data = JSON.parse(content)
|
||||||
const data = JSON.parse(content)
|
const programs = []
|
||||||
const programs = []
|
|
||||||
|
if (data.timelines) {
|
||||||
if (data.timelines) {
|
data.timelines.forEach(item => {
|
||||||
data.timelines.forEach(item => {
|
programs.push({
|
||||||
programs.push({
|
title: item.title,
|
||||||
title: item.title,
|
subTitle: item.episode?.name || '',
|
||||||
subTitle: item.episode?.name || '',
|
description: item.episode?.description || '',
|
||||||
description: item.episode?.description || '',
|
episode: item.episode?.number || '',
|
||||||
episode: item.episode?.number || '',
|
season: item.episode?.season || '',
|
||||||
season: item.episode?.season || '',
|
actors: item.episode?.clip?.actors || [],
|
||||||
actors: item.episode?.clip?.actors || [],
|
categories: [item.episode?.genre, item.episode?.subGenre].filter(Boolean),
|
||||||
categories: [item.episode?.genre, item.episode?.subGenre].filter(Boolean),
|
rating: item.episode?.rating || '',
|
||||||
rating: item.episode?.rating || '',
|
date: item.episode?.clip?.originalReleaseDate || '',
|
||||||
date: item.episode?.clip?.originalReleaseDate || '',
|
icon: item.episode?.series?.tile?.path || '',
|
||||||
icon: item.episode?.series?.tile?.path || '',
|
start: item.start,
|
||||||
start: item.start,
|
stop: item.stop
|
||||||
stop: item.stop
|
})
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
}
|
|
||||||
|
return programs
|
||||||
return programs
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -33,14 +33,17 @@ it('can parse response', () => {
|
||||||
start: '2024-12-28T00:21:00.000Z',
|
start: '2024-12-28T00:21:00.000Z',
|
||||||
stop: '2024-12-28T00:48:00.000Z',
|
stop: '2024-12-28T00:48:00.000Z',
|
||||||
title: 'Naruto: El Tercer Hokage, Eternamente',
|
title: 'Naruto: El Tercer Hokage, Eternamente',
|
||||||
description: 'Gaara y Naruto continúan combatiendo con todas sus fuerzas. Decidido a proteger a Sakura, Naruto ataca a Gaara una y otra vez.',
|
description:
|
||||||
|
'Gaara y Naruto continúan combatiendo con todas sus fuerzas. Decidido a proteger a Sakura, Naruto ataca a Gaara una y otra vez.',
|
||||||
subTitle: 'El Tercer Hokage, Eternamente',
|
subTitle: 'El Tercer Hokage, Eternamente',
|
||||||
episode: 80,
|
episode: 80,
|
||||||
season: 2,
|
season: 2,
|
||||||
actors: ["Isabel Martion (Naruto Uzumaki)",
|
actors: [
|
||||||
"Christine Byrd (Sakura Haruno)",
|
'Isabel Martion (Naruto Uzumaki)',
|
||||||
"Victor Ugarte (Sasuke Uchiha)",
|
'Christine Byrd (Sakura Haruno)',
|
||||||
"Alfonso Obreg (Kakashi Hatake)"],
|
'Victor Ugarte (Sasuke Uchiha)',
|
||||||
|
'Alfonso Obreg (Kakashi Hatake)'
|
||||||
|
],
|
||||||
categories: ['Anime', 'Anime Action & Adventure'],
|
categories: ['Anime', 'Anime Action & Adventure'],
|
||||||
rating: 'TV-14',
|
rating: 'TV-14',
|
||||||
date: '2004-04-21T00:00:00.000Z',
|
date: '2004-04-21T00:00:00.000Z',
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<channels>
|
<channels>
|
||||||
<channel site="pluto.tv" lang="en" xmltv_id="PlutoTVAdventCalendar.ca" site_id="6712256349c4060008e9e0f0">Pluto TV Advent Calendar</channel>
|
<channel site="pluto.tv" lang="en" xmltv_id="PlutoTVAdventCalendar.ca" site_id="6712256349c4060008e9e0f0">Pluto TV Advent Calendar</channel>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<channels>
|
<channels>
|
||||||
<channel site="pluto.tv" lang="en" xmltv_id="Diane,femmeflic.uk" site_id="6671b26836a2f90008d9333c">Diane, femme flic</channel>
|
<channel site="pluto.tv" lang="en" xmltv_id="Diane,femmeflic.uk" site_id="6671b26836a2f90008d9333c">Diane, femme flic</channel>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue