Update mncvision.id.config.js

This commit is contained in:
Aleksandr Statciuk 2022-03-11 14:49:59 +03:00
parent 47c4d77e7d
commit b9e6ea7660

View file

@ -30,9 +30,8 @@ module.exports = {
'Content-Type': 'multipart/form-data; boundary=X-EPG-BOUNDARY' 'Content-Type': 'multipart/form-data; boundary=X-EPG-BOUNDARY'
} }
}, },
async parser({ content, date, headers, channel }) { async parser({ content, date, headers }) {
const programs = [] const programs = []
let items = parseItems(content) let items = parseItems(content)
const pages = parsePages(content) const pages = parsePages(content)
const cookies = headers && headers['set-cookie'] ? headers['set-cookie'].join(';') : '' const cookies = headers && headers['set-cookie'] ? headers['set-cookie'].join(';') : ''
@ -54,7 +53,7 @@ module.exports = {
const stop = start.add(duration, 'm') const stop = start.add(duration, 'm')
programs.push({ programs.push({
title: parseTitle(item), title: parseTitle(item),
description: await loadDescription(item, channel), description: await loadDescription(item, cookies),
start, start,
stop stop
}) })
@ -84,17 +83,12 @@ module.exports = {
} }
} }
async function loadDescription(item, channel) { async function loadDescription(item, cookies) {
const cookies = {
en: 's1nd0vL=jgs82rfmntm362uvdbknng4l5n4lq4u4;',
id: 's1nd0vL=bfh2v7qvrsso7ck6pama3ane6bfv5k5g;'
}
const cookie = cookies[channel.lang]
const $item = cheerio.load(item) const $item = cheerio.load(item)
const progUrl = $item('a').attr('href') const progUrl = $item('a').attr('href')
if (!progUrl) return null if (!progUrl) return null
const data = await axios const data = await axios
.get(progUrl, { headers: { 'X-Requested-With': 'XMLHttpRequest', cookie } }) .get(progUrl, { headers: { 'X-Requested-With': 'XMLHttpRequest', Cookie: cookies } })
.then(r => r.data) .then(r => r.data)
.catch(console.log) .catch(console.log)
if (!data) return null if (!data) return null