diff --git a/sites/tvheute.at/tvheute.at.config.js b/sites/tvheute.at/tvheute.at.config.js new file mode 100644 index 00000000..87081acf --- /dev/null +++ b/sites/tvheute.at/tvheute.at.config.js @@ -0,0 +1,78 @@ +const cheerio = require('cheerio') +const dayjs = require('dayjs') + +module.exports = { + site: 'tvheute.at', + url({ channel, date }) { + return `https://tvheute.at/part/channel-shows/partial/${channel.site_id}/${date.format( + 'DD-MM-YYYY' + )}` + }, + logo({ content }) { + const $ = cheerio.load(content) + const imgSrc = $(`.station-info .logo`).attr('src') + + return imgSrc ? `https://tvheute.at${imgSrc}` : null + }, + parser: function ({ content, channel, date }) { + let programs = [] + const items = parseItems(content) + items.forEach(item => { + programs.push({ + title: parseTitle(item), + description: parseDescription(item), + icon: parseIcon(item), + category: parseCategory(item), + start: parseStart(item).toJSON(), + stop: parseStop(item).toJSON() + }) + }) + + return programs + } +} + +function parseTitle(item) { + const $ = cheerio.load(item) + + return $('.title-col strong').text() +} + +function parseDescription(item) { + const $ = cheerio.load(item) + + return $('.title-col .description').text() +} + +function parseCategory(item) { + const $ = cheerio.load(item) + + return $('.station-col > .type').text() +} + +function parseIcon(item) { + const $ = cheerio.load(item) + const imgSrc = $('.title-col .image img').data('src-desktop') + + return imgSrc ? `https://tvheute.at${imgSrc}` : null +} + +function parseStart(item) { + const $ = cheerio.load(item) + const time = $('.end-col > .duration-wrapper').data('start') + + return dayjs(time) +} + +function parseStop(item) { + const $ = cheerio.load(item) + const time = $('.end-col > .duration-wrapper').data('stop') + + return dayjs(time) +} + +function parseItems(content) { + const $ = cheerio.load(content) + + return $('#showListContainer > table > tbody > tr').toArray() +} diff --git a/sites/tvheute.at/tvheute.at.test.js b/sites/tvheute.at/tvheute.at.test.js new file mode 100644 index 00000000..8d58059c --- /dev/null +++ b/sites/tvheute.at/tvheute.at.test.js @@ -0,0 +1,54 @@ +// npx epg-grabber --config=sites/tvheute.at/tvheute.at.config.js --channels=sites/tvheute.at/tvheute.at_at.channels.xml --output=.gh-pages/guides/at/tvheute.at.epg.xml --days=2 + +const { parser, url, logo, request } = require('./tvheute.at.config.js') +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') +const customParseFormat = require('dayjs/plugin/customParseFormat') +dayjs.extend(customParseFormat) +dayjs.extend(utc) + +const date = dayjs.utc('2021-11-08', 'YYYY-MM-DD').startOf('d') +const channel = { site_id: 'orf1', xmltv_id: 'ORF1.at' } +const content = ` +
Das ORF1 Programm mit allen Sendungen live im TV von tv.orf.at. Sie haben eine Sendung verpasst. In der ORF TVthek finden Sie viele Sendungen on demand zum Abruf als online Video und live stream.
Sender | Zeit | Zeit | Titel | Start | Titel |
---|---|---|---|---|---|
ORF1 Kids | Monchhichi (Wh.) ANIMATIONSSERIE Der Streiche-Wettbewerb Roger hat sich Ärger mit Dr. Bellows eingehandelt, der ihn für einen Monat strafversetzen möchte. Einmal mehr hadert Roger mit dem Schicksal, dass er keinen eigenen Flaschengeist besitzt, der ihm aus der Patsche helfen kann. Jeannie schlägt vor, ihm Cousine Marilla zu schicken. Doch Tony ist strikt dagegen. Als ein Zaubererpärchen im exotischen Bühnenoutfit für die Zeit von Rogers Abwesenheit sein Apartment in Untermiete bezieht, glaubt Roger, Jeannie habe ihm ihre Verwandte doch noch gesandt. | ||||
ORF1 | ZIB 18 NACHRICHTEN |