mirror of
https://github.com/iptv-org/epg
synced 2025-12-18 11:27:06 -05:00
Update tvinsider.com.config.js
Add episode-num, sub-title and previously-shown (dependent on https://github.com/freearhey/epg-grabber/issues/26)
This commit is contained in:
committed by
GitHub
parent
11e3f2cabe
commit
87dada1781
@@ -14,6 +14,7 @@ module.exports = {
|
|||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
const prev = programs[programs.length - 1]
|
const prev = programs[programs.length - 1]
|
||||||
const $item = cheerio.load(item)
|
const $item = cheerio.load(item)
|
||||||
|
const episodeInfo = parseEP($item);
|
||||||
let start = parseStart($item, date)
|
let start = parseStart($item, date)
|
||||||
if (!start) return
|
if (!start) return
|
||||||
if (prev) {
|
if (prev) {
|
||||||
@@ -26,6 +27,9 @@ module.exports = {
|
|||||||
description: parseDescription($item),
|
description: parseDescription($item),
|
||||||
category: parseCategory($item),
|
category: parseCategory($item),
|
||||||
date: parseDate($item),
|
date: parseDate($item),
|
||||||
|
...episodeInfo,
|
||||||
|
subTitles: parseSubtitle($item),
|
||||||
|
previouslyShown: parsePreviously($item),
|
||||||
start,
|
start,
|
||||||
stop
|
stop
|
||||||
})
|
})
|
||||||
@@ -63,6 +67,32 @@ module.exports = {
|
|||||||
function parseTitle($item) {
|
function parseTitle($item) {
|
||||||
return $item('h3').text().trim()
|
return $item('h3').text().trim()
|
||||||
}
|
}
|
||||||
|
function parseEP($item){
|
||||||
|
const text = $item('h6').text().trim();
|
||||||
|
const match = text.match(/Season\s+(\d+)\s*•\s*Episode\s+(\d+)/i);
|
||||||
|
|
||||||
|
if (!match) return {}; // Return an empty object if no match, so properties are undefined later
|
||||||
|
|
||||||
|
const season = parseInt(match[1], 10);
|
||||||
|
const episode = parseInt(match[2], 10);
|
||||||
|
|
||||||
|
return { season, episode }; // Return an object with season and episode
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseSubtitle($item) {
|
||||||
|
return $item('h5').text().trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
function parsePreviously($item){
|
||||||
|
const h3Text = $item('h3').text().trim();
|
||||||
|
const isNewShow = /New$/.test(h3Text);
|
||||||
|
|
||||||
|
if (isNewShow) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function parseDescription($item) {
|
function parseDescription($item) {
|
||||||
return $item('p').text().trim()
|
return $item('p').text().trim()
|
||||||
|
|||||||
Reference in New Issue
Block a user