mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
commit
e71c224cad
2 changed files with 8 additions and 6 deletions
|
@ -1,11 +1,13 @@
|
||||||
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')
|
||||||
|
|
||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
|
dayjs.extend(timezone)
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'singtel.com',
|
site: 'singtel.com',
|
||||||
days: 2,
|
days: 3,
|
||||||
request: {
|
request: {
|
||||||
cache: {
|
cache: {
|
||||||
ttl: 60 * 60 * 1000 // 1 hour
|
ttl: 60 * 60 * 1000 // 1 hour
|
||||||
|
@ -18,7 +20,7 @@ module.exports = {
|
||||||
let programs = []
|
let programs = []
|
||||||
const items = parseItems(content, channel)
|
const items = parseItems(content, channel)
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
const start = dayjs.utc(item.startDateTime)
|
const start = dayjs.tz(item.startDateTime,'Asia/Singapore')
|
||||||
const stop = start.add(item.duration, 's')
|
const stop = start.add(item.duration, 's')
|
||||||
programs.push({
|
programs.push({
|
||||||
title: item.program.title,
|
title: item.program.title,
|
||||||
|
|
|
@ -37,8 +37,8 @@ it('can parse response', () => {
|
||||||
|
|
||||||
expect(results.length).toBe(23)
|
expect(results.length).toBe(23)
|
||||||
expect(results[0]).toMatchObject({
|
expect(results[0]).toMatchObject({
|
||||||
start: '2023-01-29T00:00:00.000Z',
|
start: '2023-01-28T16:00:00.000Z',
|
||||||
stop: '2023-01-29T01:30:00.000Z',
|
stop: '2023-01-28T17:30:00.000Z',
|
||||||
title: 'Hip Hop Family Christmas Wedding',
|
title: 'Hip Hop Family Christmas Wedding',
|
||||||
description:
|
description:
|
||||||
`Hip Hop's most famous family is back, and this time Christmas wedding bells are ringing! Jessica and Jayson are getting ready to say their "I do's".`,
|
`Hip Hop's most famous family is back, and this time Christmas wedding bells are ringing! Jessica and Jayson are getting ready to say their "I do's".`,
|
||||||
|
@ -46,8 +46,8 @@ it('can parse response', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(results[10]).toMatchObject({
|
expect(results[10]).toMatchObject({
|
||||||
start: '2023-01-29T09:00:00.000Z',
|
start: '2023-01-29T01:00:00.000Z',
|
||||||
stop: '2023-01-29T09:30:00.000Z',
|
stop: '2023-01-29T01:30:00.000Z',
|
||||||
title: 'The Daily Show',
|
title: 'The Daily Show',
|
||||||
description:
|
description:
|
||||||
"The Daily Show correspondents tackle the biggest stories in news, politics and pop culture.",
|
"The Daily Show correspondents tackle the biggest stories in news, politics and pop culture.",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue