mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Update superguidatv.it.config.js
This commit is contained in:
parent
2c89e672c8
commit
ec16197a78
1 changed files with 8 additions and 13 deletions
|
@ -1,19 +1,12 @@
|
|||
const cheerio = require('cheerio')
|
||||
const axios = require('axios')
|
||||
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)
|
||||
const { DateTime } = require('luxon')
|
||||
|
||||
module.exports = {
|
||||
site: 'superguidatv.it',
|
||||
days: 3,
|
||||
url({ channel, date }) {
|
||||
let diff = date.diff(dayjs.utc().startOf('d'), 'd')
|
||||
let diff = date.diff(DateTime.now().toUTC().startOf('day'), 'd')
|
||||
let day = {
|
||||
0: 'oggi',
|
||||
1: 'domani',
|
||||
|
@ -30,13 +23,13 @@ module.exports = {
|
|||
const prev = programs[programs.length - 1]
|
||||
let start = parseStart($item, date)
|
||||
if (prev) {
|
||||
if (start.isBefore(prev.start)) {
|
||||
start = start.add(1, 'd')
|
||||
if (start < prev.start) {
|
||||
start = start.plus({ days: 1 })
|
||||
date = date.add(1, 'd')
|
||||
}
|
||||
prev.stop = start
|
||||
}
|
||||
const stop = start.add(30, 'm')
|
||||
const stop = start.plus({ minutes: 30 })
|
||||
programs.push({
|
||||
title: parseTitle($item),
|
||||
category: parseCategory($item),
|
||||
|
@ -99,7 +92,9 @@ function parseStart($item, date) {
|
|||
.text()
|
||||
.trim()
|
||||
|
||||
return dayjs.tz(`${date.format('YYYY-MM-DD')} ${hours}`, `YYYY-MM-DD HH:mm`, 'Europe/Rome')
|
||||
return DateTime.fromFormat(`${date.format('YYYY-MM-DD')} ${hours}`, `yyyy-MM-dd HH:mm`, {
|
||||
zone: 'Europe/Rome'
|
||||
}).toUTC()
|
||||
}
|
||||
|
||||
function parseTitle($item) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue