mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00: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 = {
|
||||
site: 'tvprofil.com',
|
||||
days: 2,
|
||||
skip: true, // NOTE: server is not stable
|
||||
url: function ({ channel, date }) {
|
||||
const parts = channel.site_id.split('#')
|
||||
const query = buildQuery(parts[1], date)
|
||||
|
@ -16,11 +15,9 @@ module.exports = {
|
|||
'x-requested-with': 'XMLHttpRequest'
|
||||
}
|
||||
},
|
||||
parser: function ({ content, channel, date }) {
|
||||
parser: function ({ content }) {
|
||||
let programs = []
|
||||
const result = parseContent(content)
|
||||
if (!result) return programs
|
||||
const items = parseItems(result.data.program)
|
||||
const items = parseItems(content)
|
||||
items.forEach(item => {
|
||||
const $item = cheerio.load(item)
|
||||
const title = parseTitle($item)
|
||||
|
@ -62,18 +59,17 @@ function parseTitle($item) {
|
|||
return title.replace('®', '').trim().replace(/,$/, '')
|
||||
}
|
||||
|
||||
function parseItems(program) {
|
||||
const $ = cheerio.load(program)
|
||||
function parseItems(content) {
|
||||
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()
|
||||
}
|
||||
|
||||
function parseContent(content) {
|
||||
let data = (content.match(/cb\((.*)\)/) || [null, null])[1]
|
||||
|
||||
return JSON.parse(data)
|
||||
}
|
||||
|
||||
function buildQuery(site_id, date) {
|
||||
const query = {
|
||||
datum: date.format('YYYY-MM-DD'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue