mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Merge pull request #2090 from iptv-org/fix-superguidatv.it
Fix superguidatv.it
This commit is contained in:
commit
e12518dea5
2 changed files with 9 additions and 14 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) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// npm run channels:parse -- --config=sites/superguidatv.it/superguidatv.it.config.js --output=sites/superguidatv.it/superguidatv.it.channels.xml
|
||||
// npx epg-grabber --config=sites/superguidatv.it/superguidatv.it.config.js --channels=sites/superguidatv.it/superguidatv.it.channels.xml --output=guide.xml --days=2
|
||||
// npx epg-grabber --config=sites/superguidatv.it/superguidatv.it.config.js --channels=sites/superguidatv.it/superguidatv.it.channels.xml --output=guide.xml
|
||||
|
||||
const { parser, url } = require('./superguidatv.it.config.js')
|
||||
const fs = require('fs')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue