mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Update pluto.tv.config.js
This commit is contained in:
parent
a8e52738f6
commit
0d32c3dedd
1 changed files with 22 additions and 14 deletions
|
@ -1,22 +1,30 @@
|
||||||
const dayjs = require('dayjs');
|
const dayjs = require('dayjs')
|
||||||
const axios = require('axios');
|
const utc = require('dayjs/plugin/utc')
|
||||||
|
const timezone = require('dayjs/plugin/timezone')
|
||||||
|
const axios = require('axios')
|
||||||
|
|
||||||
|
dayjs.extend(utc)
|
||||||
|
dayjs.extend(timezone)
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'pluto.tv',
|
site: 'pluto.tv',
|
||||||
days: 2,
|
days: 3,
|
||||||
|
|
||||||
url: function ({ date, channel }) {
|
url: function ({ date, channel }) {
|
||||||
const channelId = channel.site_id;
|
const channelId = channel.site_id
|
||||||
const startTime = dayjs.utc(date).startOf('day').toISOString();
|
|
||||||
const endTime = dayjs.utc(date).add(this.days - 1, 'day').endOf('day').toISOString();
|
|
||||||
|
|
||||||
const generatedUrl = `https://api.pluto.tv/v2/channels/${channelId}?start=${startTime}&stop=${endTime}`;
|
const localTimezone = dayjs.tz.guess()
|
||||||
return generatedUrl;
|
|
||||||
|
const startTime = dayjs(date).tz(localTimezone).startOf('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}`
|
||||||
|
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 => {
|
||||||
|
@ -33,10 +41,10 @@ module.exports = {
|
||||||
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
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue