mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 17:10:07 -04:00
Update tvprofil.com.config.js
This commit is contained in:
parent
4af1a455d4
commit
802dfad8f0
1 changed files with 9 additions and 13 deletions
|
@ -4,7 +4,6 @@ const dayjs = require('dayjs')
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'tvprofil.com',
|
site: 'tvprofil.com',
|
||||||
days: 2,
|
days: 2,
|
||||||
skip: true, // NOTE: server is not stable
|
|
||||||
url: function ({ channel, date }) {
|
url: function ({ channel, date }) {
|
||||||
const parts = channel.site_id.split('#')
|
const parts = channel.site_id.split('#')
|
||||||
const query = buildQuery(parts[1], date)
|
const query = buildQuery(parts[1], date)
|
||||||
|
@ -16,11 +15,9 @@ module.exports = {
|
||||||
'x-requested-with': 'XMLHttpRequest'
|
'x-requested-with': 'XMLHttpRequest'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
parser: function ({ content, channel, date }) {
|
parser: function ({ content }) {
|
||||||
let programs = []
|
let programs = []
|
||||||
const result = parseContent(content)
|
const items = parseItems(content)
|
||||||
if (!result) return programs
|
|
||||||
const items = parseItems(result.data.program)
|
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
const $item = cheerio.load(item)
|
const $item = cheerio.load(item)
|
||||||
const title = parseTitle($item)
|
const title = parseTitle($item)
|
||||||
|
@ -62,18 +59,17 @@ function parseTitle($item) {
|
||||||
return title.replace('®', '').trim().replace(/,$/, '')
|
return title.replace('®', '').trim().replace(/,$/, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseItems(program) {
|
function parseItems(content) {
|
||||||
const $ = cheerio.load(program)
|
let data = (content.match(/cb\((.*)\)/) || [null, null])[1]
|
||||||
|
if (!data) return []
|
||||||
|
let json = JSON.parse(data)
|
||||||
|
if (!json || !json.data || !json.data.program) return []
|
||||||
|
|
||||||
|
const $ = cheerio.load(json.data.program)
|
||||||
|
|
||||||
return $('.row').toArray()
|
return $('.row').toArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseContent(content) {
|
|
||||||
let data = (content.match(/cb\((.*)\)/) || [null, null])[1]
|
|
||||||
|
|
||||||
return JSON.parse(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildQuery(site_id, date) {
|
function buildQuery(site_id, date) {
|
||||||
const query = {
|
const query = {
|
||||||
datum: date.format('YYYY-MM-DD'),
|
datum: date.format('YYYY-MM-DD'),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue