From 1c212037691e90995926e4efb2f9b076c34ec6e2 Mon Sep 17 00:00:00 2001 From: fraudiay79 <60631277+fraudiay79@users.noreply.github.com> Date: Fri, 17 Jan 2025 14:39:24 -0500 Subject: [PATCH] Delete sites/vivacom.bg directory --- sites/vivacom.bg/readme.md | 15 --- sites/vivacom.bg/vivacom.bg.channels.xml | 158 ----------------------- sites/vivacom.bg/vivacom.bg.config.js | 77 ----------- sites/vivacom.bg/vivacom.bg.test.js | 44 ------- 4 files changed, 294 deletions(-) delete mode 100644 sites/vivacom.bg/readme.md delete mode 100644 sites/vivacom.bg/vivacom.bg.channels.xml delete mode 100644 sites/vivacom.bg/vivacom.bg.config.js delete mode 100644 sites/vivacom.bg/vivacom.bg.test.js diff --git a/sites/vivacom.bg/readme.md b/sites/vivacom.bg/readme.md deleted file mode 100644 index 51d24bd0..00000000 --- a/sites/vivacom.bg/readme.md +++ /dev/null @@ -1,15 +0,0 @@ -# vivacom.bg - -https://www.vivacom.bg/ - -### Download the guide - -```sh -npm run grab --- --site=vivacom.bg -``` - -### Test - -```sh -npm test --- vivacom.bg -``` diff --git a/sites/vivacom.bg/vivacom.bg.channels.xml b/sites/vivacom.bg/vivacom.bg.channels.xml deleted file mode 100644 index 128015d4..00000000 --- a/sites/vivacom.bg/vivacom.bg.channels.xml +++ /dev/null @@ -1,158 +0,0 @@ - - - FilmBox Basic - 24 Kitchen - 7/8 TV - Agro TV - Alfa TV - AMC - Animal Planet - AXN Black - AXN - AXN White - B1B Box - Barely Legal TV - BG Music Channel - Bloomberg TV Bulgaria - BNT 1 - BNT 2 - BNT 3 - BNT 4 - BTV - BTV Action - BTV Cinema - BTV Comedy - BTV Lady - Bulgaria 24 - Bulgaria On Air - Bulgarska Svobodna TV - Cartoon Network - CBS Reality - Cinemax 2 - Cinemax - Crime + Investigation - Da Vinci - Deluxe Lounge - Deluxe Music - Diema - Diema Family - Diema Sport - Diema Sport 2 - Discovery Channel - Discovery Science - Disney Channel - DocuBox HD - Dorcel TV - Duck TV - EKids - Epic Drama - Erox HD - Eroxxx - Eurosport 1 - Eurosport 2 - Evrokom - Fen Folk - Fen TV - FilmBox Extra - FilmBox Stars - Folklor TV - Food Network - Fox HD - Fox Crime - Fox Life - France 24 - HBO 2 - HBO 3 - HBO - Hit Mix Channel - Hustler TV - Investigation Discovery - JimJam - Kino Nova - Magic TV - Max Sport 1 HD - Max Sport 2 HD - Max Sport 3 HD - Mediaset Italia - Movie Star - National Geographic HD - National Geographic Wild HD - Nickelodeon - Nick Jr - Nova News HD - Nova Sport - Nova TV - Penthouse HD - Planeta Folk - Planeta TV - Playboy TV HD - Redlight - Ring - RTL - Show Turk - SKAT - TGCom 24 - The Fishing & Hunting Channel - The Voice TV - The World - Tiankov Folk - TLC - Travel TV - TRT World - TV 1 - TV 1000 - TV 3 - TV 999 - TV Bulgare - TV Evropa - TV Tourism - Viasat Explore - Viasat History - Viasat Nature - Vivacom Arena HD - Vox - VTK - Wness TV - XXL - Auto Motor und Sport - Jukebox - Motorvision TV - 360 Tune Box - Baby TV - Balkanika Music TV - Boomerang - Box TV - City TV - Club MTV - CNN - Code Health TV - DM Sat - DW - English Club TV - Eurochannel - EuroNews HD - Extreme Sports Channel - FashionBox HD - Fast & FunBox - FightBox HD - FilmBox Arthouse Worldwide - Fuel TV - Gametoon - Mezzo - MTV 00s - MTV 80s - MTV 90s - MTV Hits - MTV Live - RT Arabic - Stingray IConcerts - Wild TV - Chasse & Pêche - TVR International - TV 1000 Russkoe Kino - BeIn Movies Turk - Habertürk - Kanal 7 Avrupa - TV 8 - Yaban - \ No newline at end of file diff --git a/sites/vivacom.bg/vivacom.bg.config.js b/sites/vivacom.bg/vivacom.bg.config.js deleted file mode 100644 index 53ea4edf..00000000 --- a/sites/vivacom.bg/vivacom.bg.config.js +++ /dev/null @@ -1,77 +0,0 @@ -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: 'vivacom.bg', - days: 2, - 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}` - }, - parser: function ({ content, channel, date }) { - let programs = [] - const items = parseItems(content, channel) - items.forEach(item => { - programs.push({ - title: parseTitle(item), - description: parseDescription(item), - start: parseStart(item, date), - stop: parseStop(item, date) - }) - }) - - return programs - } -} - -function parseStart(item, date) { - const $ = cheerio.load(item) - let [, time] = $('span') - .text() - .match(/^(\d{2}:\d{2}:\d{2})/) || [null, null] - if (!time) return null - time = `${date.format('YYYY-MM-DD')} ${time}` - - return dayjs.tz(time, 'YYYY-MM-DD HH:mm:ss', 'Europe/Sofia').toJSON() -} - -function parseStop(item, date) { - const $ = cheerio.load(item) - let [, time] = $('span') - .text() - .match(/(\d{2}:\d{2}:\d{2})$/) || [null, null] - if (!time) return null - if (time === '00:00:00') date = date.add(1, 'd') - time = `${date.format('YYYY-MM-DD')} ${time}` - - return dayjs.tz(time, 'YYYY-MM-DD HH:mm:ss', 'Europe/Sofia').toJSON() -} - -function parseTitle(item) { - const $ = cheerio.load(item) - - return $('h3').text() -} - -function parseDescription(item) { - const $ = cheerio.load(item) - - return $('p').text() -} - -function parseItems(content, channel) { - const [, channelId] = channel.site_id.split('#') - const $ = cheerio.load(content) - const listItem = $(`#scroll-vertical > li[title="${channelId}"]`) - const i = $('#scroll-vertical > li').index(listItem) - - return $(`#scroll-horizontal > ul:nth-child(${i + 1}) li`).toArray() -} diff --git a/sites/vivacom.bg/vivacom.bg.test.js b/sites/vivacom.bg/vivacom.bg.test.js deleted file mode 100644 index 78032f94..00000000 --- a/sites/vivacom.bg/vivacom.bg.test.js +++ /dev/null @@ -1,44 +0,0 @@ -const { parser, url } = require('./vivacom.bg.config.js') -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-05', 'YYYY-MM-DD').startOf('d') -const channel = { site_id: '1#БНТ 1 HD', xmltv_id: 'BNT1.bg' } -const content = - '
  • Когато сърцето зове

    04:25:00 - 05:10:00

    Телевизионен филм. Тв филм /4 сезон, 5 епизод/п/

  • Dreamy Nights: Songs & Rhymes

    23:30:00 - 00:00:00

    Songs & Rhymes, Flowers, Milky Way, Close Your Eyes, Twilight

' - -it('can generate valid url', () => { - const result = url({ date, channel }) - expect(result).toBe('https://www.vivacom.bg/bg/tv/programa/?date=2021-11-05&page=1') -}) - -it('can parse response', () => { - const result = parser({ date, channel, content }) - expect(result).toMatchObject([ - { - start: '2021-11-05T02:25:00.000Z', - stop: '2021-11-05T03:10:00.000Z', - title: 'Когато сърцето зове', - description: 'Телевизионен филм. Тв филм /4 сезон, 5 епизод/п/' - }, - { - start: '2021-11-05T21:30:00.000Z', - stop: '2021-11-05T22:00:00.000Z', - title: 'Dreamy Nights: Songs & Rhymes', - description: 'Songs & Rhymes, Flowers, Milky Way, Close Your Eyes, Twilight' - } - ]) -}) - -it('can handle empty guide', () => { - const result = parser({ - date, - channel, - content: - '
' - }) - expect(result).toMatchObject([]) -})