From 9f5c597fa5a813eafd336f9d60ffc0850d3dd9ab Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Sun, 19 Nov 2023 16:38:21 +0300 Subject: [PATCH] Delete guide.dstv.com Replaced by https://www.dstv.com/en-za/explore/tv-guide --- .../guide.dstv.com.channels.xml | 324 ------------------ sites/guide.dstv.com/guide.dstv.com.config.js | 94 ----- sites/guide.dstv.com/guide.dstv.com.test.js | 59 ---- 3 files changed, 477 deletions(-) delete mode 100644 sites/guide.dstv.com/guide.dstv.com.channels.xml delete mode 100644 sites/guide.dstv.com/guide.dstv.com.config.js delete mode 100644 sites/guide.dstv.com/guide.dstv.com.test.js diff --git a/sites/guide.dstv.com/guide.dstv.com.channels.xml b/sites/guide.dstv.com/guide.dstv.com.channels.xml deleted file mode 100644 index 02133757..00000000 --- a/sites/guide.dstv.com/guide.dstv.com.channels.xml +++ /dev/null @@ -1,324 +0,0 @@ - - - 1KZN TV - 1 Magic Africa - Abol TV - Addis Media Network - Adom TV - Africa Magic Epic - Africa Magic Family - Africa Magic Hausa - Africa Magic Igbo - Africa Magic Showcase Africa - Africa Magic Urban - Africa Magic Yoruba - Africanews - Afro Music Pop - Ahadu TV - AIT International - Akili Kids! - Aljazeera English - Amhara TV - Arewa 24 - Arise News - ARTS TV - Asham TV - AYV TV - B4U Movies UK - Baba TV - Balageru TV - BBC Brit South Africa - BBC Earth South Africa - BBC Lifestyle South Africa - BBC World News Africa - BBS TV - BET Africa - Big Brother Mzansi - Bloomberg TV Africa - Boomerang EMEA - Botswana TV - Bukedde TV 1 - BusinessDay TV - Camnet TV - Cape Town TV - Cartoon Network Middle East & Africa - CBeebies South Africa - CBS Justice Africa - CBS Reality Africa - CCTV 4 Europe - CCTV Entertainment - CGTN - CGTN Documentary - CGTN Français - Channel 44 - Channel O - Channels TV - Citizen TV - CNBC Africa - CNN International Europe - Comedy Central Africa - Curiosity Channel - Da Vinci - Daystar TV - Diamond TV - Discovery Channel Middle East & Africa - Discovery Family Africa - Disney Channel South Africa - Disney Junior South Africa - Dominion TV - Dove TV - Dumisa TV - DW Deutsch - E! Africa - EBS - Edu Channel - E Extra - Emmanuel TV - E Movies - E Movies Extra - ENews Channel Africa - ESPN 2 Africa - ESPN Africa - E Toonz - E TV - E TV Africa - ETV News - EuroNews English - EuroNews Français - EuroNews Deutsch - EuroNews Português - EWTN Africa - Asia - Faith Africa - Fana TV - FliekNet - Food Network EMEA - Galaxy TV - Gau TV - Ghana Learning TV - Ghana TV - Gh One TV - Ginx eSports TV International - HGTV South Africa - Hip TV - History Africa - Honey - Ignition - Inooro TV - Investigation Discovery Africa - Iqraa Africa & Europe - Islam Channel - ITV Networks - Jiangsu TV - JimJam Europe - Joy News - Joy Prime - K24 - Kameme TV - Kass TV - KBC Channel 1 - KBN - Kiss TV - Kix - KTN Home - KTN News - KykNet - KykNet & Kie - KykNet Nou! - Lagos TV - Lifetime Africa - Lumen Christi TV Network - Maisha Magic Bongo - Maisha Magic Movies - Maisha Magic Plus - Maisha Magic Poa - Mambo Moto TV - MBC - Me - Mibawa TV - Mindset Learn - MITV - M-Net East - M-Net Movies 1 East Africa - M-Net Movies 1 West Africa - M-Net Movies 2 - M-Net Movies 3 - M-Net Movies 4 - M-Net Movies Men of Action - M-Net South Africa - M-Net West - Moja Love - MovieRoom - Mpuma Kapa TV - MTV Africa - MTV Base Africa - My Channel Africa - Mzansi Bioskop - Mzansi Magic - Mzansi Magic Music - Mzansi Wethu - Nahoo TV - National Geographic South Africa - National Geographic Wild South Africa - NBC 2 - NBS TV - NDTV 24x7 - Newzroom Afrika - NHK World Japan - Nickelodeon Africa - Nick Jr Africa - NickToons Africa - Novela Magic - Now! TV - NTA 2 - NTA International - NTA News 24 - NTA Parliament - NTV - NTV Uganda - OBN - Ogun State TV - One Africa TV - One Gospel - OneZed - Parliament TV - Parliament TV - PBS Kids - Pearl Magic Prime - People&apos;s Weather - Plus TV Africa - Pop Central - Power TV - Racing 240 - Rai Italia Africa - Real Time Africa - Rok - Rok 2 - Rok GH - RT News - SABC 1 - SABC 2 - SABC 3 - SABC News - Salt TV - SBN International - Silverbird TV - Sky News International - Soundcity Africa - Soweto TV - Spice - SSBC TV - StarLife - STN - Studio Universal Africa - Sunna TV - SuperSport Action Africa - SuperSport Blitz Africa - SuperSport Cricket Africa - SuperSport Football Africa - SuperSport Football Plus Africa - SuperSport Golf Africa - SuperSport Grandstand Africa - SuperSport LaLiga Africa - SuperSport Máximo 1 Africa - SuperSport Máximo 2 Africa - SuperSport Motorsport Africa - SuperSport OTT - SuperSport OTT 2 - SuperSport OTT 3 - SuperSport OTT 4 - SuperSport OTT 5 - SuperSport OTT 6 - SuperSport OTT 7 - SuperSport OTT 8 - SuperSport Play - SuperSport Premier League Africa - SuperSport PSL - SuperSport Rugby Africa - SuperSport Tennis Africa - SuperSport Variety 1 Africa - SuperSport Variety 2 Africa - SuperSport Variety 3 Africa - SuperSport Variety 4 Africa - Tanzania Safari Channel - TBN Africa - Telemundo Africa - Televista - Tellytrack 1 - The Home Channel - TLC Africa - Tlnovelas Europa - TNT Africa - Trace Gospel English Speaking Africa - Trace Jama - Trace Muzika - Trace Mziki - Trace Naija - Travel Channel Europe - Trybe TV - Tshwane TV - TV 1 - TV 3 - TV 47 - TV5Monde Afrique - TV Africa - TVC News - TV E - TV Lesotho - TV Moçambique Internacional - TV West - UBC TV - United TV - Universal TV Africa - Urban TV - Via - Walta TV - Wap TV - Wasafi TV - Wazobia Max TV Nigeria - WildEarth - WWE Channel - Y254 - Yadah TV - Zambezi Magic - ZBC TV - Zee Alem - Zee World - ZNBC TV 1 - ZNBC TV 2 - Zodiak TV - Afro Music Channel - AXN Movies - AXN Portugal - Banda TV - Best Brasil - Boomerang Portugal - Boom TV - Canal Panda Portugal - Cine Mundo - Disney Junior Portugal - DSTV Pipoca - Fé TV - Fox Comedy Portugal - Fox Crime Portugal - Fox Life Portugal - Fox Movies Portugal - Fox Portugal - Luta Pela Fama - Media Mais TV - MundoFox - National Geographic Portugal - Palanca TV - Record News - RTP África - RTP Internacional Europa - Soico TV - Strong Live - SuperSport Máximo 360 - TLN Network - TPA 1 - TPA2 - Trace Toca - TVM - TV Miramar - TV Zimbo - \ No newline at end of file diff --git a/sites/guide.dstv.com/guide.dstv.com.config.js b/sites/guide.dstv.com/guide.dstv.com.config.js deleted file mode 100644 index 212cf8cc..00000000 --- a/sites/guide.dstv.com/guide.dstv.com.config.js +++ /dev/null @@ -1,94 +0,0 @@ -const axios = require('axios') -const cheerio = require('cheerio') -const dayjs = require('dayjs') -const utc = require('dayjs/plugin/utc') -const customParseFormat = require('dayjs/plugin/customParseFormat') - -dayjs.extend(utc) -dayjs.extend(customParseFormat) - -// ERR: certificate has expired -module.exports = { - site: 'guide.dstv.com', - days: 2, - request: { - cache: { - ttl: 60 * 60 * 1000, - interpretHeader: false - } - }, - url({ channel, date }) { - const [bouquetId] = channel.site_id.split('#') - - return `https://guide.dstv.com/api/gridview/page?bouquetId=${bouquetId}&genre=all&date=${date.format( - 'YYYY-MM-DD' - )}` - }, - parser({ content, date, channel }) { - const programs = [] - const items = parseItems(content, channel) - items.forEach(item => { - const prev = programs[programs.length - 1] - let start = parseStart(item, date) - if (prev) { - if (start.isBefore(prev.start)) { - start = start.add(1, 'd') - date = date.add(1, 'd') - } - prev.stop = start - } else if (start.hour() > 12) { - start = start.subtract(1, 'd') - date = date.subtract(1, 'd') - } - const stop = start.add(1, 'h') - programs.push({ - title: item.title, - start, - stop - }) - }) - - return programs - }, - async channels({ bouquet }) { - const data = await axios - .get( - `https://guide.dstv.com/api/channel/fetchChannelsByGenresInBouquet?bouquetId=${bouquet}&genre=all` - ) - .then(r => r.data) - .catch(console.log) - - const items = data.items - return items.map(item => { - return { - lang: 'en', - site_id: `${bouquet}#${item.channelTag}`, - name: item.channelName - } - }) - } -} - -function parseStart(item, date) { - const time = `${date.format('MM/DD/YYYY')} ${item.time}` - - return dayjs.utc(time, 'MM/DD/YYYY HH:mm') -} - -function parseItems(content, channel) { - const [, channelTag] = channel.site_id.split('#') - const data = JSON.parse(content) - const html = data[channelTag] - if (!html) return [] - const $ = cheerio.load(html) - - return $('li') - .map((i, el) => { - return { - time: $(el).find('.event-time').text().trim(), - title: $(el).find('.event-title').text().trim() - } - }) - .toArray() - .filter(i => i.time && i.title) -} diff --git a/sites/guide.dstv.com/guide.dstv.com.test.js b/sites/guide.dstv.com/guide.dstv.com.test.js deleted file mode 100644 index 4e4f18f1..00000000 --- a/sites/guide.dstv.com/guide.dstv.com.test.js +++ /dev/null @@ -1,59 +0,0 @@ -// npm run grab -- --site=guide.dstv.com -// npm run channels:parse -- --config=./sites/guide.dstv.com/guide.dstv.com.config.js --output=./sites/guide.dstv.com/guide.dstv.com.channels.xml --set=bouquet:c35aaecd-5dd1-480b-ae24-357e600a0e4d - -const { parser, url } = require('./guide.dstv.com.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-24', 'YYYY-MM-DD').startOf('d') -const channel = { - site_id: 'b0dc42b8-c651-4c3c-8713-a7fcd04744ee#M4H', - xmltv_id: 'MNetMovies4.za' -} - -it('can generate valid url', () => { - const result = url({ date, channel }) - expect(result).toBe( - 'https://guide.dstv.com/api/gridview/page?bouquetId=b0dc42b8-c651-4c3c-8713-a7fcd04744ee&genre=all&date=2021-11-24' - ) -}) - -it('can parse response', () => { - const content = - "{\"M4H\": \"
  • 21:30

    Deadly Flight

  • 08:25

    I Still Believe

  • 15:50

    Despicable Me

  • 20:35

    The Foreigner

  • \"}" - const result = parser({ date, channel, content }).map(p => { - p.start = p.start.toJSON() - p.stop = p.stop.toJSON() - return p - }) - expect(result).toMatchObject([ - { - start: '2021-11-23T21:30:00.000Z', - stop: '2021-11-24T08:25:00.000Z', - title: 'Deadly Flight' - }, - { - start: '2021-11-24T08:25:00.000Z', - stop: '2021-11-24T15:50:00.000Z', - title: 'I Still Believe' - }, - { - start: '2021-11-24T15:50:00.000Z', - stop: '2021-11-24T20:35:00.000Z', - title: 'Despicable Me' - }, - { - start: '2021-11-24T20:35:00.000Z', - stop: '2021-11-24T21:35:00.000Z', - title: 'The Foreigner' - } - ]) -}) - -it('can handle empty guide', () => { - const result = parser({ date, channel, content: '{}' }) - expect(result).toMatchObject([]) -})