mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-11 01:20:08 -04:00
Merge pull request #2083 from iptv-org/fix-programtv.onet.pl
Fix programtv.onet.pl
This commit is contained in:
commit
3d3df28347
3 changed files with 7 additions and 15 deletions
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<site site="programtv.onet.pl">
|
||||
<channels>
|
||||
<!-- <channel lang="pl" xmltv_id="FilmBoxPremiumPoland.pl" site_id="filmbox-premium-85">FilmBox Premium Polska</channel> -->
|
||||
<channel lang="pl" xmltv_id="13thStreet.de" site_id="13th-street-250">13th Street Deutschland</channel>
|
||||
<channel lang="pl" xmltv_id="13Ulica.pl" site_id="13-ulica-316">13 Ulica</channel>
|
||||
<channel lang="en" xmltv_id="360TuneBox.nl" site_id="360tunebox-302">360 Tune Box</channel>
|
||||
|
|
|
@ -1,19 +1,12 @@
|
|||
const cheerio = require('cheerio')
|
||||
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 = {
|
||||
delay: 5000,
|
||||
site: 'programtv.onet.pl',
|
||||
days: 2,
|
||||
url: function ({ date, channel }) {
|
||||
const currDate = dayjs.utc().startOf('d')
|
||||
const currDate = DateTime.now().toUTC().startOf('day')
|
||||
const day = date.diff(currDate, 'd')
|
||||
|
||||
return `https://programtv.onet.pl/program-tv/${channel.site_id}?dzien=${day}`
|
||||
|
@ -26,13 +19,13 @@ module.exports = {
|
|||
const $item = cheerio.load(item)
|
||||
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(1, 'h')
|
||||
const stop = start.plus({ hours: 1 })
|
||||
programs.push({
|
||||
title: parseTitle($item),
|
||||
description: parseDescription($item),
|
||||
|
@ -50,7 +43,7 @@ function parseStart($item, date) {
|
|||
const timeString = $item('.hours > .hour').text()
|
||||
const dateString = `${date.format('MM/DD/YYYY')} ${timeString}`
|
||||
|
||||
return dayjs.tz(dateString, 'MM/DD/YYYY HH:mm', 'Europe/Warsaw')
|
||||
return DateTime.fromFormat(dateString, 'MM/dd/yyyy HH:mm', { zone: 'Europe/Warsaw' }).toUTC()
|
||||
}
|
||||
|
||||
function parseCategory($item) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// npx epg-grabber --config=sites/programtv.onet.pl/programtv.onet.pl.config.js --channels=sites/programtv.onet.pl/programtv.onet.pl.channels.xml --output=guide.xml --days=2
|
||||
// npx epg-grabber --config=sites/programtv.onet.pl/programtv.onet.pl.config.js --channels=sites/programtv.onet.pl/programtv.onet.pl.channels.xml --output=guide.xml
|
||||
|
||||
const MockDate = require('mockdate')
|
||||
const { parser, url } = require('./programtv.onet.pl.config.js')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue