mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Create flixed.io.config.js
This commit is contained in:
parent
a0c9603e04
commit
3de6d40306
1 changed files with 45 additions and 0 deletions
45
sites/flixed.io/flixed.io.config.js
Normal file
45
sites/flixed.io/flixed.io.config.js
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
const dayjs = require('dayjs')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
site: 'flixed.io',
|
||||||
|
days: 1, // NOTE: changing the date in a request does not change the response
|
||||||
|
url: function ({ date, channel }) {
|
||||||
|
return `https://tv-guide.vercel.app/api/stationAirings?stationId=${
|
||||||
|
channel.site_id
|
||||||
|
}&startDateTime=${date.toJSON()}`
|
||||||
|
},
|
||||||
|
parser({ content }) {
|
||||||
|
let programs = []
|
||||||
|
let items = parseItems(content)
|
||||||
|
items.forEach(item => {
|
||||||
|
programs.push({
|
||||||
|
title: item.program.title,
|
||||||
|
description: item.program.longDescription,
|
||||||
|
category: item.program.subType,
|
||||||
|
icon: parseIcon(item),
|
||||||
|
start: parseStart(item),
|
||||||
|
stop: parseStop(item)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return programs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseIcon(item) {
|
||||||
|
const uri = item.program.preferredImage.uri
|
||||||
|
|
||||||
|
return uri ? `https://adma.tmsimg.com/assets/${uri}` : null
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseStart(item) {
|
||||||
|
return dayjs(item.startTime)
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseStop(item) {
|
||||||
|
return dayjs(item.endTime)
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseItems(content, channel) {
|
||||||
|
return JSON.parse(content)
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue