mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
commit
8d0a7ac4df
2 changed files with 17 additions and 9 deletions
|
@ -1,8 +1,12 @@
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
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 customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
|
|
||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
|
dayjs.extend(timezone)
|
||||||
|
dayjs.extend(customParseFormat)
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'dstv.com',
|
site: 'dstv.com',
|
||||||
|
@ -30,8 +34,8 @@ module.exports = {
|
||||||
description: parseDescription(details),
|
description: parseDescription(details),
|
||||||
icon: parseIcon(details),
|
icon: parseIcon(details),
|
||||||
category: parseCategory(details),
|
category: parseCategory(details),
|
||||||
start: parseStart(item),
|
start: parseTime(item.StartTime),
|
||||||
stop: parseStop(item)
|
stop: parseTime(item.EndTime)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,12 +79,16 @@ async function loadProgramDetails(item) {
|
||||||
.catch(console.error)
|
.catch(console.error)
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseStart(item) {
|
// function parseStart(item) {
|
||||||
return dayjs.utc(item.StartTime, 'YYYY-MM-DDTHH:mm:ss')
|
// return dayjs.utc(item.StartTime, 'YYYY-MM-DDTHH:mm:ss')
|
||||||
}
|
// }
|
||||||
|
|
||||||
function parseStop(item) {
|
// function parseStop(item) {
|
||||||
return dayjs.utc(item.EndTime, 'YYYY-MM-DDTHH:mm:ss')
|
// return dayjs.utc(item.EndTime, 'YYYY-MM-DDTHH:mm:ss')
|
||||||
|
// }
|
||||||
|
|
||||||
|
function parseTime(time) {
|
||||||
|
return dayjs.tz(time, 'YYYY-MM-DDTHH:mm:ss', 'Africa/Johannesburg')
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseItems(content, channel) {
|
function parseItems(content, channel) {
|
||||||
|
|
|
@ -63,8 +63,8 @@ it('can parse response', done => {
|
||||||
|
|
||||||
expect(result).toMatchObject([
|
expect(result).toMatchObject([
|
||||||
{
|
{
|
||||||
start: '2022-03-11T00:10:00.000Z',
|
start: '2022-03-10T22:10:00.000Z',
|
||||||
stop: '2022-03-11T00:50:00.000Z',
|
stop: '2022-03-10T22:50:00.000Z',
|
||||||
title: 'Curb Your Enthusiasm'
|
title: 'Curb Your Enthusiasm'
|
||||||
// description:
|
// description:
|
||||||
// "'S11/E6 of 10 - Man Fights Tiny Woman'. A general entertainment channel showcasing the best international content, focusing on scripted drama, comedy and talk.",
|
// "'S11/E6 of 10 - Man Fights Tiny Woman'. A general entertainment channel showcasing the best international content, focusing on scripted drama, comedy and talk.",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue