mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Update tvhebdo.com.config.js
This commit is contained in:
parent
4a70daabb2
commit
45b06307ba
1 changed files with 8 additions and 12 deletions
|
@ -1,17 +1,11 @@
|
||||||
const cheerio = require('cheerio')
|
const cheerio = require('cheerio')
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const dayjs = require('dayjs')
|
const { DateTime } = require('luxon')
|
||||||
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: 'tvhebdo.com',
|
site: 'tvhebdo.com',
|
||||||
days: 2,
|
days: 2,
|
||||||
|
timeout: 30000, // 30s
|
||||||
url: function ({ channel, date }) {
|
url: function ({ channel, date }) {
|
||||||
return `https://www.tvhebdo.com/horaire-tele/${channel.site_id}/date/${date.format(
|
return `https://www.tvhebdo.com/horaire-tele/${channel.site_id}/date/${date.format(
|
||||||
'YYYY-MM-DD'
|
'YYYY-MM-DD'
|
||||||
|
@ -25,12 +19,12 @@ module.exports = {
|
||||||
const $item = cheerio.load(item)
|
const $item = cheerio.load(item)
|
||||||
let start = parseStart($item, date)
|
let start = parseStart($item, date)
|
||||||
if (prev) {
|
if (prev) {
|
||||||
if (start.isBefore(prev.start)) {
|
if (start < prev.start) {
|
||||||
start = start.add(1, 'd')
|
start = start.plus({ days: 1 })
|
||||||
}
|
}
|
||||||
prev.stop = start
|
prev.stop = start
|
||||||
}
|
}
|
||||||
let stop = start.add(30, 'm')
|
let stop = start.plus({ minutes: 30 })
|
||||||
programs.push({
|
programs.push({
|
||||||
title: parseTitle($item),
|
title: parseTitle($item),
|
||||||
start,
|
start,
|
||||||
|
@ -87,7 +81,9 @@ function parseTitle($item) {
|
||||||
function parseStart($item, date) {
|
function parseStart($item, date) {
|
||||||
const time = $item('.heure').text()
|
const time = $item('.heure').text()
|
||||||
|
|
||||||
return dayjs.tz(`${date.format('YYYY-MM-DD')} ${time}`, 'YYYY-MM-DD HH:mm', 'America/Toronto')
|
return DateTime.fromFormat(`${date.format('YYYY-MM-DD')} ${time}`, 'yyyy-MM-dd HH:mm', {
|
||||||
|
zone: 'America/Toronto'
|
||||||
|
}).toUTC()
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseItems(content) {
|
function parseItems(content) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue