From eb12de48fdbcdc422f02c15b9fae55f16354be40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Moret?= <30985701+BellezaEmporium@users.noreply.github.com> Date: Wed, 14 Aug 2024 11:55:13 +0200 Subject: [PATCH 1/2] Delete sites/disneystar.com directory Disney/Star stopped giving TV Guides. --- .../disneystar.com.channels.xml | 60 ------------- sites/disneystar.com/disneystar.com.config.js | 88 ------------------- sites/disneystar.com/disneystar.com.test.js | 64 -------------- sites/disneystar.com/readme.md | 21 ----- 4 files changed, 233 deletions(-) delete mode 100644 sites/disneystar.com/disneystar.com.channels.xml delete mode 100644 sites/disneystar.com/disneystar.com.config.js delete mode 100644 sites/disneystar.com/disneystar.com.test.js delete mode 100644 sites/disneystar.com/readme.md diff --git a/sites/disneystar.com/disneystar.com.channels.xml b/sites/disneystar.com/disneystar.com.channels.xml deleted file mode 100644 index 01aa0b8fc..000000000 --- a/sites/disneystar.com/disneystar.com.channels.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - Asianet - Asianet HD - Asianet Movies - Asianet Plus - Fox Life - Fox Life HD - Jalsha Movies - Jalsha Movies HD - National Geographic Channel - National Geographic Channel HD - Nat Geo Wild - Nat Geo Wild HD - Star Bharat - Star Bharat HD - Star Gold - Star Gold 2 - Star Gold HD - Star Gold Select - Star Gold Select HD - Star Jalsha - Star Jalsha HD - Star Maa - Star Maa Gold - Star Maa HD - Star Maa Movies - Star Maa Movies HD - Star Maa Music - Star Movies - Star Movies HD - Star Movies Select HD - STAR PLUS - STAR PLUS HD - Star Pravah - Star Pravah HD - Star Sports 1 - Star Sports 1 HD - Star Sports 1 Hindi - Star Sports 1 HD Hindi - Star Sports 1 Kannada - Star Sports 1 Tamil - Star Sports 1 Telugu - Star Sports 2 - Star Sports 2 HD - Star Sports 3 - Star Sports First - Star Sports Select 1 - Star Sports Select 1 HD - Star Sports Select 2 - Star Sports Select 2 HD - Star Suvarna - Star Suvarna HD - Star Suvarna Plus - Star Utsav - Star Utsav Movies - Star Vijay - Star Vijay HD - Star Vijay Super - \ No newline at end of file diff --git a/sites/disneystar.com/disneystar.com.config.js b/sites/disneystar.com/disneystar.com.config.js deleted file mode 100644 index 834417251..000000000 --- a/sites/disneystar.com/disneystar.com.config.js +++ /dev/null @@ -1,88 +0,0 @@ -const axios = require('axios') -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) - -const API_ENDPOINT = 'https://www.disneystar.com/umbraco/api/startvguideproxy' - -module.exports = { - site: 'disneystar.com', - days: 2, - url: `${API_ENDPOINT}/GetTvGuideSchedule`, - request: { - method: 'POST', - headers: { - 'Content-Type': 'application/json; charset=UTF-8' - }, - data({ channel, date }) { - return { - Channels: channel.site_id, - Start: date.format('YYYYMMDDHHmm'), - Stop: date.add(1, 'd').format('YYYYMMDDHHmm') - } - } - }, - parser: function ({ content, channel }) { - let programs = [] - const items = parseItems(content, channel) - items.forEach(item => { - programs.push({ - title: item.title, - description: item.desc, - image: item.programmeurl, - category: item.subgenre, - start: parseStart(item), - stop: parseStop(item) - }) - }) - - return programs - }, - async channels() { - const data = await axios - .post( - `${API_ENDPOINT}/GetChannelResult`, - { Genre: 'All Channels' }, - { - headers: { - 'Content-Type': 'application/json; charset=UTF-8' - } - } - ) - .then(r => JSON.parse(r.data)) - .catch(console.log) - - const channels = data.channelsbygenreandlanguage.channellist.channelnames.split(',') - return channels.map(item => { - return { - lang: 'hi', - site_id: item, - name: item - } - }) - } -} - -function parseStart(item) { - return dayjs.tz(item.start, 'YYYYMMDDHHmm', 'Asia/Kolkata') -} - -function parseStop(item) { - return dayjs.tz(item.stop, 'YYYYMMDDHHmm', 'Asia/Kolkata') -} - -function parseItems(content, channel) { - if (!content.length) return [] - const json = JSON.parse(content) - if (!json.length) return [] - const data = JSON.parse(json) - if (!data || !data.ScheduleGrid || !Array.isArray(data.ScheduleGrid.channel)) return [] - const channelData = data.ScheduleGrid.channel.find(c => c.channeldisplayname === channel.site_id) - - return channelData && Array.isArray(channelData.programme) ? channelData.programme : [] -} diff --git a/sites/disneystar.com/disneystar.com.test.js b/sites/disneystar.com/disneystar.com.test.js deleted file mode 100644 index ee883f35a..000000000 --- a/sites/disneystar.com/disneystar.com.test.js +++ /dev/null @@ -1,64 +0,0 @@ -const { parser, url, request } = require('./disneystar.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('2022-03-31', 'YYYY-MM-DD').startOf('d') -const channel = { - site_id: 'STAR PLUS', - xmltv_id: 'StarPlus.in' -} - -it('can generate valid url', () => { - expect(url).toBe('https://www.disneystar.com/umbraco/api/startvguideproxy/GetTvGuideSchedule') -}) - -it('can generate valid request method', () => { - expect(request.method).toBe('POST') -}) - -it('can generate valid request headers', () => { - expect(request.headers).toMatchObject({ - 'Content-Type': 'application/json; charset=UTF-8' - }) -}) - -it('can generate valid request data', () => { - expect(request.data({ channel, date })).toMatchObject({ - Channels: 'STAR PLUS', - Start: '202203310000', - Stop: '202204010000' - }) -}) - -it('can parse response', () => { - const content = - '"{\\"ScheduleGrid\\":{\\"channel\\":[{\\"id\\":null,\\"displayname\\":null,\\"channelid\\":\\"10000000000080000\\",\\"channellogourl\\":\\"http://imagesstartv.whatsonindia.com/dasimages/channel/landscape/100x75/wHtcYVRZ.png\\",\\"channelgenre\\":\\"Hindi Entertainment\\",\\"channelweburl\\":\\"\\",\\"channeldisplayname\\":\\"STAR PLUS\\",\\"lcn\\":\\"1\\",\\"isfav\\":\\"0\\",\\"programme\\":[{\\"programmeid\\":\\"30000000550792674\\",\\"title\\":\\"Imlie\\",\\"start\\":\\"202203310000\\",\\"stop\\":\\"202203310030\\",\\"desc\\":\\"Imlie finds herself in deep trouble when she gets tied up before the wedding. Meanwhile, Aryan assumes that he is getting married to Imlie and performs the wedding rituals.\\",\\"programmeurl\\":\\"http://imagesstartv.whatsonindia.com/dasimages/landscape/360x270/59A9215E5DE13ABF4B05C59A6C87768AD61CA608M.jpg\\",\\"channelid\\":\\"10000000000080000\\",\\"date\\":\\"20220331\\",\\"episodenum\\":null,\\"subtitle\\":null,\\"scheduleid\\":\\"10000069158583187\\",\\"genre\\":\\"TV Show\\",\\"subgenre\\":\\"Drama\\",\\"programmescore\\":\\"0.083309\\",\\"languagename\\":\\"Hindi\\",\\"dubbedlanguageid\\":\\"10000000000040000\\",\\"timestring\\":\\"12:00 AM, Tomorrow\\",\\"duration\\":\\"30\\",\\"episodeshorttitle\\":\\"\\"}]}]}}"' - const result = parser({ content, channel }).map(p => { - p.start = p.start.toJSON() - p.stop = p.stop.toJSON() - return p - }) - - expect(result).toMatchObject([ - { - start: '2022-03-30T18:30:00.000Z', - stop: '2022-03-30T19:00:00.000Z', - title: 'Imlie', - description: - 'Imlie finds herself in deep trouble when she gets tied up before the wedding. Meanwhile, Aryan assumes that he is getting married to Imlie and performs the wedding rituals.', - image: - 'http://imagesstartv.whatsonindia.com/dasimages/landscape/360x270/59A9215E5DE13ABF4B05C59A6C87768AD61CA608M.jpg', - category: 'Drama' - } - ]) -}) - -it('can handle empty guide', () => { - const result = parser({ - content: '""' - }) - expect(result).toMatchObject([]) -}) diff --git a/sites/disneystar.com/readme.md b/sites/disneystar.com/readme.md deleted file mode 100644 index 20ad11cc0..000000000 --- a/sites/disneystar.com/readme.md +++ /dev/null @@ -1,21 +0,0 @@ -# disneystar.com - -https://www.disneystar.com/tv-guide/ - -### Download the guide - -```sh -npm run grab -- --site=disneystar.com -``` - -### Update channel list - -```sh -npm run channels:parse -- --config=sites/disneystar.com/disneystar.com.config.js --output=sites/disneystar.com/disneystar.com.channels.xml -``` - -### Test - -```sh -npm test -- disneystar.com -``` From 58aec983343603ba3a2ac2bff78861668b277eb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Moret?= <30985701+BellezaEmporium@users.noreply.github.com> Date: Sun, 8 Sep 2024 14:09:49 +0200 Subject: [PATCH 2/2] Update SITES.md --- SITES.md | 1 - 1 file changed, 1 deletion(-) diff --git a/SITES.md b/SITES.md index fbf992008..7ff3de550 100644 --- a/SITES.md +++ b/SITES.md @@ -35,7 +35,6 @@ | [directv.com.ar](sites/directv.com.ar) | 🔴 | https://github.com/iptv-org/epg/issues/2248 | | [directv.com.uy](sites/directv.com.uy) | 🟢 | | | [dishtv.in](sites/dishtv.in) | 🟢 | | -| [disneystar.com](sites/disneystar.com) | 🟢 | | | [dsmart.com.tr](sites/dsmart.com.tr) | 🟢 | | | [dstv.com](sites/dstv.com) | 🟢 | | | [elcinema.com](sites/elcinema.com) | 🟢 | |