Update tv.yandex.ru

This commit is contained in:
Aleksandr Statciuk 2022-02-01 05:42:27 +03:00
parent 46fa2f0bb7
commit a2e2d0da60
2 changed files with 6 additions and 17 deletions

View file

@ -2,21 +2,16 @@ const dayjs = require('dayjs')
module.exports = { module.exports = {
site: 'tv.yandex.ru', site: 'tv.yandex.ru',
request: {
headers: {
Cookie:
'yandexuid=8747786251615498142; Expires=Tue, 11 Mar 2031 21:29:02 GMT; Domain=yandex.ru; Path=/'
}
},
url: function ({ date, channel }) { url: function ({ date, channel }) {
const [region, id] = channel.site_id.split('#') const [region, id] = channel.site_id.split('#')
return `https://tv.yandex.ru/${region}/channel/${id}?date=${date.format('YYYY-MM-DD')}` return `https://tv.yandex.ru/${region}/channel/${id}?date=${date.format('YYYY-MM-DD')}`
}, },
logo: function ({ content }) { request: {
const data = parseContent(content) headers: {
Cookie:
return data ? `https:${data.channel.logo.maxSize.src}` : null 'yandexuid=8747786251615498142; Expires=Tue, 11 Mar 2031 21:29:02 GMT; Domain=yandex.ru; Path=/'
}
}, },
parser: function ({ content }) { parser: function ({ content }) {
const programs = [] const programs = []

View file

@ -1,6 +1,6 @@
// npx epg-grabber --config=sites/tv.yandex.ru/tv.yandex.ru.config.js --channels=sites/tv.yandex.ru/tv.yandex.ru_kz.channels.xml --output=.gh-pages/guides/kz/tv.yandex.ru.epg.xml --days=2 // npx epg-grabber --config=sites/tv.yandex.ru/tv.yandex.ru.config.js --channels=sites/tv.yandex.ru/tv.yandex.ru_kz.channels.xml --output=.gh-pages/guides/kz/tv.yandex.ru.epg.xml --days=2
const { parser, url, request, logo } = require('./tv.yandex.ru.config.js') const { parser, url, request } = require('./tv.yandex.ru.config.js')
const dayjs = require('dayjs') const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc') const utc = require('dayjs/plugin/utc')
const customParseFormat = require('dayjs/plugin/customParseFormat') const customParseFormat = require('dayjs/plugin/customParseFormat')
@ -27,12 +27,6 @@ it('can generate valid request headers', () => {
}) })
}) })
it('can generate valid logo url', () => {
expect(logo({ content })).toBe(
'https://avatars.mds.yandex.net/get-tv-channel-logos/30303/2a00000170e2a3ef22bf7cfa4ff11e8405de/170x100'
)
})
it('can parse response', () => { it('can parse response', () => {
const result = parser({ content }).map(p => { const result = parser({ content }).map(p => {
p.start = p.start.toJSON() p.start = p.start.toJSON()