mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Use timezone offset to get programme list
This commit is contained in:
parent
5600003128
commit
a7a4b3c95b
1 changed files with 13 additions and 2 deletions
|
@ -1,12 +1,23 @@
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
|
const utc = require('dayjs/plugin/utc')
|
||||||
|
const timezone = require('dayjs/plugin/timezone')
|
||||||
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
|
|
||||||
|
dayjs.extend(utc)
|
||||||
|
dayjs.extend(timezone)
|
||||||
|
dayjs.extend(customParseFormat)
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'mewatch.sg',
|
site: 'mewatch.sg',
|
||||||
days: 2,
|
days: 2,
|
||||||
url: function ({ channel, date }) {
|
url: function ({ channel, date }) {
|
||||||
return `https://cdn.mewatch.sg/api/schedules?channels=${channel.site_id}&date=${date.format(
|
const utcDate = date.isUTC() ? date.tz(dayjs.tz.guess(), true).utc() : date.utc()
|
||||||
|
|
||||||
|
return `https://cdn.mewatch.sg/api/schedules?channels=${channel.site_id}&date=${utcDate.format(
|
||||||
'YYYY-MM-DD'
|
'YYYY-MM-DD'
|
||||||
)}&duration=24&ff=idp,ldp,rpt,cd&hour=21&intersect=true&lang=en&segments=all`
|
)}&duration=24&ff=idp,ldp,rpt,cd&hour=${utcDate.format(
|
||||||
|
'HH'
|
||||||
|
)}&intersect=true&lang=en&segments=all`
|
||||||
},
|
},
|
||||||
parser: function ({ content, channel }) {
|
parser: function ({ content, channel }) {
|
||||||
let programs = []
|
let programs = []
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue