Update vivacom.bg

This commit is contained in:
Aleksandr Statciuk 2022-02-01 05:56:51 +03:00
parent 28364c5837
commit 34d28dd855
2 changed files with 2 additions and 14 deletions

View file

@ -9,20 +9,13 @@ dayjs.extend(timezone)
dayjs.extend(customParseFormat)
module.exports = {
ignore: true, // INFO: no longer available
site: 'vivacom.bg',
ignore: true, // INFO: no longer available
url({ date, channel }) {
const [page] = channel.site_id.split('#')
return `https://www.vivacom.bg/bg/tv/programa/?date=${date.format('YYYY-MM-DD')}&page=${page}`
},
logo({ content, channel }) {
const [_, channelId] = channel.site_id.split('#')
const $ = cheerio.load(content)
const imgSrc = $(`li[title="${channelId}"] > img`).attr('src')
return imgSrc ? `https://www.vivacom.bg${imgSrc}` : null
},
parser: function ({ content, channel, date }) {
let programs = []
const items = parseItems(content, channel)

View file

@ -1,6 +1,6 @@
// npx epg-grabber --config=sites/vivacom.bg/vivacom.bg.config.js --channels=sites/vivacom.bg/vivacom.bg_bg.channels.xml --output=.gh-pages/guides/bg/vivacom.bg.epg.xml --days=2
const { parser, url, logo, request } = require('./vivacom.bg.config.js')
const { parser, url, request } = require('./vivacom.bg.config.js')
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const customParseFormat = require('dayjs/plugin/customParseFormat')
@ -16,11 +16,6 @@ it('can generate valid url', () => {
expect(result).toBe('https://www.vivacom.bg/bg/tv/programa/?date=2021-11-05&page=1')
})
it('can get logo url', () => {
const result = logo({ content, channel })
expect(result).toBe('https://www.vivacom.bg/web/files/richeditor/tv/bnt-1-hd.png')
})
it('can parse response', () => {
const result = parser({ date, channel, content })
expect(result).toMatchObject([