diff --git a/sites/tvgid.ua/tvgid.ua.channels.xml b/sites/tvgid.ua/tvgid.ua.channels.xml deleted file mode 100644 index 34bc262e..00000000 --- a/sites/tvgid.ua/tvgid.ua.channels.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - 1+1 - 24 Kanal - 2+2 - 34 Telekanal - 5 Kanal - 8 Kanal - Ajara TV - Animal Planet - BBC World News - Belarus 24 - Bigudi - Cartoon Network - CBS Reality - Che! - ChePe Info - Detski Mir - Discovery Channel Europe - Discovery Science - Domashniy - Donbass - DTX Polska - Enter Film - Espreso TV - Eu Music - Eurosport 1 Rossiya - Eurosport 2 Rossiya - Evrokino - Extreme Sports Channel - Fox Life - Fox - Futbol 1 - Futbol 2 - ICTV - Indigo TV - Inter - Inter + - Investigation Discovery Europe - K1 - K2 - Kinohit - Kinomiks - Kinopremyera - Kvartal TV - Kyïv TV - M1 - Malyatko TV - Match! - Match! Arena - Match! Boets - Match! Igra - Mega - Mir - Multilandia - Muzhskoe Kino - Muz TV - Nash - Nashe Novoe Kino - National Geographic - National Geographic Wild - Nickelodeon CIS - NLO TV - Novy Kanal - NTN - Obozrevatel TV - Oce - Ohotnik i Rybolov - OTB Galychyna - Paramount Comedy - Pershiy Diloviy - Piksel TV - Plus Plus - Polsat - Pryamyy - Pyatnitsa! - Rossiya K - Ryzhiy - Setanta Sports Ukraine - Sonce - Sony Sci-Fi - Star Cinema - Star Family - STS - Telekanal Spas - Telekanal STB - - TET - Travel Channel - TV 1000 Action - TV 1000 East - TV 1000 World Kino - TV 3 - TV-4 - TV 5 - TV Bolt - TVP 1 - TVP 2 - TVP Polonia - TV XXI - U - UA: Kultura - UA: Pershiy - UA: Zakarpattya - Unian TV - Viasat Explore - Viasat History - Viasat Nature - Viasat Sport - VIP Comedy - X Sport - Zhivi! - Zoom - Zoo Park - Zoo TV - - \ No newline at end of file diff --git a/sites/tvgid.ua/tvgid.ua.config.js b/sites/tvgid.ua/tvgid.ua.config.js deleted file mode 100644 index a8e123d5..00000000 --- a/sites/tvgid.ua/tvgid.ua.config.js +++ /dev/null @@ -1,63 +0,0 @@ -const iconv = require('iconv-lite') -const cheerio = require('cheerio') -const dayjs = require('dayjs') -const utc = require('dayjs/plugin/utc') -const timezone = require('dayjs/plugin/timezone') -const customParseFormat = require('dayjs/plugin/customParseFormat') - -dayjs.extend(utc) -dayjs.extend(timezone) -dayjs.extend(customParseFormat) - -module.exports = { - site: 'tvgid.ua', - days: 2, - skip: true, // NOTE: the current program is not currently available on the website - url: function ({ date, channel }) { - return `https://tvgid.ua/channels/${channel.site_id}/${date.format('DDMMYYYY')}/tmall/` - }, - parser: function ({ buffer, date }) { - const programs = [] - const items = parseItems(buffer) - items.forEach(item => { - const $item = cheerio.load(item) - const prev = programs[programs.length - 1] - let start = parseStart($item, date) - if (!start) return - const stop = start.add(1, 'h') - if (prev) { - if (start.isBefore(prev.start)) { - start = start.add(1, 'd') - date = date.add(1, 'd') - } - prev.stop = start - } - - programs.push({ title: parseTitle($item), start, stop }) - }) - - return programs - } -} - -function parseStart($item, date) { - const timeString = $item('td > table > tbody > tr > td.time').text() - if (!timeString) return null - const dateString = `${date.format('MM/DD/YYYY')} ${timeString}` - - return dayjs.tz(dateString, 'MM/DD/YYYY HH:mm', 'Europe/Kiev') -} - -function parseTitle($item) { - return $item('td > table > tbody > tr > td.item').text().trim() -} - -function parseItems(buffer) { - if (!buffer) return [] - const html = iconv.decode(buffer, 'win1251') - const $ = cheerio.load(html) - - return $( - '#container > tbody > tr:nth-child(2) > td > table > tbody > tr > td > table:nth-child(2) > tbody > tr:not(:first-child)' - ).toArray() -} diff --git a/sites/tvgid.ua/tvgid.ua.test.js b/sites/tvgid.ua/tvgid.ua.test.js deleted file mode 100644 index 28a6112b..00000000 --- a/sites/tvgid.ua/tvgid.ua.test.js +++ /dev/null @@ -1,56 +0,0 @@ -// npx epg-grabber --config=sites/tvgid.ua/tvgid.ua.config.js --channels=sites/tvgid.ua/tvgid.ua.channels.xml --output=guide.xml --days=2 - -const { parser, url } = require('./tvgid.ua.config.js') -const iconv = require('iconv-lite') -const dayjs = require('dayjs') -const utc = require('dayjs/plugin/utc') -const customParseFormat = require('dayjs/plugin/customParseFormat') -dayjs.extend(customParseFormat) -dayjs.extend(utc) - -const date = dayjs.utc('2021-11-24', 'YYYY-MM-DD').startOf('d') -const channel = { - site_id: '1plus1', - xmltv_id: '1Plus1.ua' -} - -it('can generate valid url', () => { - expect(url({ channel, date })).toBe('https://tvgid.ua/channels/1plus1/24112021/tmall/') -}) - -it('can parse response', () => { - const content = `

Телепрограма 1+1 на 24.11.2021

1+1 Обговорити (917)
06:30 "Сніданок з 1+1" 
00:35Х/ф "Біля моря"
03:00 "#Гуднайт_клаб" 
` - const buffer = iconv.encode(Buffer.from(content), 'win1251') - const result = parser({ buffer, date }).map(p => { - p.start = p.start.toJSON() - p.stop = p.stop.toJSON() - return p - }) - - expect(result).toMatchObject([ - { - start: '2021-11-24T04:30:00.000Z', - stop: '2021-11-24T22:35:00.000Z', - title: `"Сніданок з 1+1"` - }, - { - start: '2021-11-24T22:35:00.000Z', - stop: '2021-11-25T01:00:00.000Z', - title: `Х/ф "Біля моря"` - }, - { - start: '2021-11-25T01:00:00.000Z', - stop: '2021-11-25T02:00:00.000Z', - title: `"#Гуднайт_клаб"` - } - ]) -}) - -it('can handle empty guide', () => { - const result = parser({ - date, - channel, - content: `` - }) - expect(result).toMatchObject([]) -})