diff --git a/sites/cubmu.com/cubmu.com.channels.xml b/sites/cubmu.com/cubmu.com.channels.xml new file mode 100644 index 00000000..69b1495e --- /dev/null +++ b/sites/cubmu.com/cubmu.com.channels.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ABC Australia + Al Jazeera + ANTV + Arirang + BTV + Bioskop Indonesia + Boonie Cubs TV + CCTV 4 + CGTN + CGTN Documentary + CNA + CNBC Indonesia + CNN Indonesia + DAAI TV + Duck TV + Dunia Anak + Dunia Lain + Eat N Go + English Club TV + Euronews + Fashion TV + Fight TV Premium + France 24 + Golf+ + GTV + Indosiar + Jak tv + jtv + Khazanah + Kompas TV + Lingua + MetroTV + MNC TV + Musik Indonesia + Nabawi TV + NET TV + !nsert + Nusantara + One TV + Outdoor America + Pijar TV + Gaming TV + Pro Wrestling TV + Al Quran Al Kareem + rtv + RCTI + Russia Today + SCTV + Channel Seru! + SuperYacht TV + Toon Goggles + Trans 7 + Trans TV + TV5 Monde + TV9 + tv Mu + tvOne + TVRI + Wion TV + diff --git a/sites/cubmu.com/cubmu.com.config.js b/sites/cubmu.com/cubmu.com.config.js new file mode 100644 index 00000000..a1064e52 --- /dev/null +++ b/sites/cubmu.com/cubmu.com.config.js @@ -0,0 +1,98 @@ +const dayjs = require('dayjs') +const timezone = require('dayjs/plugin/timezone') +const utc = require('dayjs/plugin/utc') + +dayjs.extend(timezone) +dayjs.extend(utc) + +module.exports = { + site: 'cubmu.com', + days: 2, + url: function ({ channel, date }) { + return `https://servicebuss.transvision.co.id/v2/cms/getEPGData?app_id=cubmu&tvs_platform_id=standalone&schedule_date=${date.format('YYYY-MM-DD')}&channel_id=${channel.site_id}` + }, + parser({ content }) { + const programs = [] + const items = parseItems(content) + items.forEach(item => { + programs.push({ + title: parseTitle(item), + description: parseDescription(item), + episode: parseEpisode(item), + start: parseStart(item).toISOString(), + stop: parseStop(item).toISOString() + }) + }) + + return programs + }, + async channels() { + const axios = require('axios') + const cheerio = require('cheerio') + const result = await axios + .get('https://cubmu.com/live-tv') + .then(response => response.data) + .catch(console.error) + + const $ = cheerio.load(result) + + // retrieve service api data + const config = JSON.parse($('#__NEXT_DATA__').text()).runtimeConfig || {} + + const options = { + headers: { + Origin: 'https://cubmu.com', + Referer: 'https://cubmu.com/live-tv' + } + } + // login to service bus + const token = await axios + .post(`https://servicebuss.transvision.co.id/tvs/login/external?email=${config.email}&password=${config.password}&deviceId=${config.deviceId}&deviceType=${config.deviceType}&deviceModel=${config.deviceModel}&deviceToken=&serial=&platformId=${config.platformId}`, options) + .then(response => response.data) + .catch(console.error) + // list channels + const subscribedChannels = await axios + .post(`https://servicebuss.transvision.co.id/tvs/subscribe_product/list?platformId=${config.platformId}`, options) + .then(response => response.data) + .catch(console.error) + + const channels = [] + if (Array.isArray(subscribedChannels.channelPackageList)) { + subscribedChannels.channelPackageList.forEach(pkg => { + channels.push(...pkg.channelList.map(channel => { + return { + lang: 'id', + site_id: channel.id, + name: channel.name + } + })) + }) + } + + return channels + } +} + +function parseItems(content) { + return content ? JSON.parse(content.trim()).result || [] : [] +} + +function parseTitle(item) { + return item.scehedule_title +} + +function parseDescription(item) { + return item.schedule_json.primarySynopsis +} + +function parseEpisode(item) { + return item.schedule_json.episodeName +} + +function parseStart(item) { + return dayjs.tz(item.schedule_date, 'YYYY-MM-DD HH:mm:ss', 'Asia/Jakarta') +} + +function parseStop(item) { + return dayjs.tz([item.schedule_date.split(' ')[0], item.schedule_end_time].join(' '), 'YYYY-MM-DD HH:mm:ss', 'Asia/Jakarta') +} diff --git a/sites/cubmu.com/cubmu.com.test.js b/sites/cubmu.com/cubmu.com.test.js new file mode 100644 index 00000000..7c9737d2 --- /dev/null +++ b/sites/cubmu.com/cubmu.com.test.js @@ -0,0 +1,35 @@ +const { url, parser } = require('./cubmu.com.config.js') +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') +dayjs.extend(utc) + +const date = dayjs.utc('2023-11-05', 'DD/MM/YYYY').startOf('d') +const channel = { site_id: '4028c68574537fcd0174be43042758d8', xmltv_id: 'TransTV.id', lang: 'id' } + +it('can generate valid url', () => { + expect(url({ channel, date })).toBe( + 'https://servicebuss.transvision.co.id/v2/cms/getEPGData?app_id=cubmu&tvs_platform_id=standalone&schedule_date=2023-11-05&channel_id=4028c68574537fcd0174be43042758d8' + ) +}) + +it('can parse response', () => { + const content = + '{"result":[{"channel_id":"4028c68574537fcd0174be43042758d8","channel_name":"Trans TV","scehedule_title":"CNN Tech News","schedule_date":"2023-11-05 01:30:00","schedule_end_time":"02:00:00","schedule_json":{"availability":0,"channelId":"4028c68574537fcd0174be43042758d8","channelName":"Trans TV","duration":1800,"editable":true,"episodeName":"","imageUrl":"https://cdnjkt2.transvision.co.id:1001/catchup/schedule/thumbnail/4028c68574537fcd0174be43042758d8/4028c6858b8b3621018b9330e3701a7e/458x640","imageUrlWide":"https://cdnjkt2.transvision.co.id:1001/catchup/schedule/thumbnail/4028c68574537fcd0174be43042758d8/4028c6858b8b3621018b9330e3701a7e/320x180","name":"CNN Tech News","ottImageUrl":"","primarySynopsis":"CNN Indonesia Tech News adalah berita teknologi yang membawa pemirsa ke dunia teknologi yang penuh dengan informasi, pendidikan, hiburan sampai informasi kesehatan terkini.","scheduleId":"4028c6858b8b3621018b9330e3701a7e","scheduleTime":"18:30:00","secondarySynopsis":"CNN Indonesia Tech News is tech news brings viewers into the world of technology that provides information, education, entertainment to the latest health information.","startDt":"20231104183000","url":""},"schedule_start_time":"01:30:00"}]}' + const results = parser({ content, channel }) + + expect(results).toMatchObject([ + { + start: '2023-11-04T18:30:00.000Z', + stop: '2023-11-04T19:00:00.000Z', + title: 'CNN Tech News', + description: + "CNN Indonesia Tech News adalah berita teknologi yang membawa pemirsa ke dunia teknologi yang penuh dengan informasi, pendidikan, hiburan sampai informasi kesehatan terkini." + } + ]) +}) + +it('can handle empty guide', () => { + const results = parser({ content: '' }) + + expect(results).toMatchObject([]) +}) diff --git a/sites/mncvision.id/mncvision.id.config.js b/sites/mncvision.id/mncvision.id.config.js index f33adbb8..4414fabf 100644 --- a/sites/mncvision.id/mncvision.id.config.js +++ b/sites/mncvision.id/mncvision.id.config.js @@ -64,21 +64,23 @@ module.exports = { return programs }, - async channels() { - const data = await axios + async channels({lang = 'id'}) { + const axios = require('axios') + const cheerio = require('cheerio') + const result = await axios .get('https://www.mncvision.id/schedule') .then(response => response.data) .catch(console.error) - const $ = cheerio.load(data) + const $ = cheerio.load(result) const items = $('select[name="fchannel"] option').toArray() const channels = items.map(item => { - const $item = cheerio.load(item) + const $item = $(item) return { - lang: 'id', - site_id: $item('*').attr('value'), - name: $item('*').text() + lang: lang, + site_id: $item.attr('value'), + name: $item.text().split(' - ')[0].trim() } }) diff --git a/sites/mncvision.id/mncvision.id_en.channels.xml b/sites/mncvision.id/mncvision.id_en.channels.xml index 9a2a131b..77ce513c 100644 --- a/sites/mncvision.id/mncvision.id_en.channels.xml +++ b/sites/mncvision.id/mncvision.id_en.channels.xml @@ -1,100 +1,126 @@ + + ABC Australia Aljazeera - Animal Planet - Animax Asia + Animax ANTV - Arirang - Asian Food Network + Arirang World AXN - Baby TV + AXN HD BBC Earth + BBC Earth HD BBC World News - BeIn Sports 1 - BeIn Sports 3 BTV - Besmart Bloomberg TV - Boomerang - Cartoon - CBeebies + CBeebies Asia Celestial Classic Movies Celestial Movies CGTN CGTN Documentary - Cinemax + CINEMACHI + CINEMACHI HD + CINEMACHI ACTION + CINEMACHI ACTION HD + CINEMACHI KIDS + CINEMACHI KIDS HD + CINEMACHI MAX + CINEMACHI MAX HD + CINEMACHI XTRA + CINEMACHI XTRA HD CNA CNBC - CNN International Crime + Investigation - Discovery Channel + Dreamworks DW English - Ent + Entertainment + EURONEWS Fight Sports FMN Fox News Channel France 24 Galaxy Galaxy Premium + Global Trekker GTV - HBO Asia - HBO Family Asia - HBO Hits - HBO Signature Asia - HGTV Asia + GTV HD History Hits Hits Movies + HITS MOVIES HD IDX Channel - Ie + IDX HD IMC Indosiar INews + iNews HD Jak TV Kids TV Kix Kompas TV Life - Lifestyle & Fashion - Lifetime Asia + Lifetime + Love Nature + Love Nature HD Metro TV - Miao Mi - MNC News - MNC Sports - MNC Sports 2 - MNC Sports 3 - MNC TV - M Shop Signature - M Shop Super Sale! + Sindo News TV + Sindo News TV HD + Sportstars 2 + Sportstars 2 HD + Sportstars 3 + Sportstars 4 + Sportstars 4 HD + Sportstars + Sportstars HD + MNCTV + MNCTV HD + MTV 90's + MTV LIVE Music TV Muslim TV - National Geographic - National Geographic Wild + My Cinema + My Cinema Asia + My Family + My Kidz NET NHK World Japan NHK World Premium Nickelodeon - Nick Jr Asia + Nick Jr + Nick Jr. HD OK TV One + ONE HD + Outdoor Channel + Outdoor channel HD + PARAMOUNT + PARAMOUNT HD Quran TV RCTI + RCTI HD + Rock Entertainment + Rock Action SCTV SEA Today Soccer Channel - SPOTV + Soccer Channel HD SPOTV 2 + SPOTV 2 HD + SPOTV + SPOTV HD Tawaf TV Thrill - TLC Trans 7 Trans TV tvN + tvN HD tvN Movies + tvN Movies HD TVOne TVRI Nasional + Vision Prime HD Vision Prime - Warner TV Zee Bioskop + Zoomoo diff --git a/sites/mncvision.id/mncvision.id_id.channels.xml b/sites/mncvision.id/mncvision.id_id.channels.xml index 603972ea..e0821b4b 100644 --- a/sites/mncvision.id/mncvision.id_id.channels.xml +++ b/sites/mncvision.id/mncvision.id_id.channels.xml @@ -1,100 +1,126 @@ + + ABC Australia Aljazeera - Animal Planet Animax ANTV Arirang World - Asian Food Network AXN - Baby TV + AXN HD BBC Earth + BBC Earth HD BBC World News - BeIn Sports 1 - BeIn Sports 3 BTV - Besmart Bloomberg TV - Boomerang - Cartoon Network CBeebies Asia Celestial Classic Movies Celestial Movies CGTN CGTN Documentary - Cinemax Asia + CINEMACHI + CINEMACHI HD + CINEMACHI ACTION + CINEMACHI ACTION HD + CINEMACHI KIDS + CINEMACHI KIDS HD + CINEMACHI MAX + CINEMACHI MAX HD + CINEMACHI XTRA + CINEMACHI XTRA HD CNA CNBC - CNN International Crime + Investigation - Discovery Channel + Dreamworks DW English - Ent + Entertainment + EURONEWS Fight Sports FMN Fox News Channel France 24 Galaxy Galaxy Premium + Global Trekker GTV - HBO - HBO Family - HBO Hits - HBO Signature - HGTV + GTV HD History Hits Hits Movies + HITS MOVIES HD IDX Channel - Ie + IDX HD IMC Indosiar INews + iNews HD Jak TV Kids TV Kix Kompas TV Life - Lifestyle & Fashion Lifetime + Love Nature + Love Nature HD Metro TV - Miao Mi - MNC News - MNC Sports - MNC Sports 2 - MNC Sports 3 - MNC TV - M Shop Signature - M Shop Super Sale! + Sindo News TV + Sindo News TV HD + Sportstars 2 + Sportstars 2 HD + Sportstars 3 + Sportstars 4 + Sportstars 4 HD + Sportstars + Sportstars HD + MNCTV + MNCTV HD + MTV 90's + MTV LIVE Music TV Muslim TV - National Geographic - National Geographic Wild + My Cinema + My Cinema Asia + My Family + My Kidz NET NHK World Japan NHK World Premium Nickelodeon Nick Jr + Nick Jr. HD OK TV One + ONE HD + Outdoor Channel + Outdoor channel HD + PARAMOUNT + PARAMOUNT HD Quran TV RCTI + RCTI HD + Rock Entertainment + Rock Action SCTV SEA Today Soccer Channel - SPOTV + Soccer Channel HD SPOTV 2 + SPOTV 2 HD + SPOTV + SPOTV HD Tawaf TV Thrill - TLC Trans 7 Trans TV tvN + tvN HD tvN Movies + tvN Movies HD TVOne TVRI Nasional + Vision Prime HD Vision Prime - Warner TV Zee Bioskop + Zoomoo