diff --git a/sites/mbc.net/mbc.net.channels.xml b/sites/mbc.net/mbc.net.channels.xml deleted file mode 100644 index 59c83549..00000000 --- a/sites/mbc.net/mbc.net.channels.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - MBC - MBC USA - MBC 2 - MBC 4 - MBC 5 - MBC Action - MBC Bollywood - MBC Drama - MBC Drama USA - MBC Iraq - MBC Maser - MBC Maser 2 - MBC Maser USA - MBC Max - MBC Drama + - MBC + Power - Wanasah - \ No newline at end of file diff --git a/sites/mbc.net/mbc.net.config.js b/sites/mbc.net/mbc.net.config.js deleted file mode 100644 index 8e2b8d88..00000000 --- a/sites/mbc.net/mbc.net.config.js +++ /dev/null @@ -1,40 +0,0 @@ -const dayjs = require('dayjs') - -module.exports = { - site: 'mbc.net', - days: 2, - url({ date, channel }) { - return `https://www.mbc.net/.rest/api/channel/grids?from=${date.valueOf()}&to=${date - .add(1, 'd') - .valueOf()}&channel=${channel.site_id}` - }, - parser: function ({ content }) { - let programs = [] - const items = parseItems(content) - items.forEach(item => { - programs.push({ - title: item.showPageTitle, - category: item.showPageGenreInArabic, - description: item.showPageAboutInArabic, - start: parseStart(item), - stop: parseStop(item) - }) - }) - - return programs - } -} - -function parseStart(item) { - return dayjs(item.startTime).toJSON() -} - -function parseStop(item) { - return dayjs(item.endTime).toJSON() -} - -function parseItems(content) { - const data = JSON.parse(content) - - return data -} diff --git a/sites/mbc.net/mbc.net.test.js b/sites/mbc.net/mbc.net.test.js deleted file mode 100644 index 23318c2f..00000000 --- a/sites/mbc.net/mbc.net.test.js +++ /dev/null @@ -1,46 +0,0 @@ -// npm run grab -- --site=mbc.net - -const { parser, url } = require('./mbc.net.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-06', 'YYYY-MM-DD').startOf('d') -const channel = { - site_id: 'mbc1', - xmltv_id: 'MBC.ae' -} -const content = - '[{"id":3140240,"channelBCMId":"1","channelLabel":"MBC1","showPageTitle":"اختطاف","showPageGenreInArabic":" دراما","showPageAboutInArabic":".يستضيف برنامج تلفزيوني والدة لينا وشقيقتها، ولدى مشاهدتها الحلقة، تكتشف والدة ماجد الحقيقة، بينما تتعرض العنود لحادث سير مروع","startTime":1636155131000,"endTime":1636157806000,"startTimeInMilliseconds":1636155131000,"endTimeInMilliseconds":1636157806200,"premiereMode":"Fast Repeat","showingNow":false}]' - -it('can generate valid url', () => { - const result = url({ date, channel }) - expect(result).toBe( - 'https://www.mbc.net/.rest/api/channel/grids?from=1636156800000&to=1636243200000&channel=mbc1' - ) -}) - -it('can parse response', () => { - const result = parser({ date, channel, content }) - expect(result).toMatchObject([ - { - start: '2021-11-05T23:32:11.000Z', - stop: '2021-11-06T00:16:46.000Z', - title: 'اختطاف', - category: ' دراما', - description: - '.يستضيف برنامج تلفزيوني والدة لينا وشقيقتها، ولدى مشاهدتها الحلقة، تكتشف والدة ماجد الحقيقة، بينما تتعرض العنود لحادث سير مروع' - } - ]) -}) - -it('can handle empty guide', () => { - const result = parser({ - date, - channel, - content: '[]' - }) - expect(result).toMatchObject([]) -})