This commit is contained in:
freearhey
2021-03-10 21:31:32 +03:00
parent ce8565f133
commit 96eb13d2e6
6 changed files with 1470 additions and 51 deletions

View File

@@ -0,0 +1,21 @@
module.exports = {
url: function ({ date, channel }) {
return `https://tv.yandex.ru/channel/${channel.site_id}?date=${date.format('YYYY-MM-DD')}`
},
parser: function ({ channel, content }) {
const initialState = content.match(/window.__INITIAL_STATE__ = (.*);/i)[1]
const data = JSON.parse(initialState, null, 2)
const programs = data.channel.schedule.events.map(i => {
return {
title: i.title,
description: i.program.description,
start: i.start,
stop: i.finish,
lang: 'ru',
channel: channel['xmltv_id']
}
})
return programs
}
}