diff --git a/sites/mewatch.sg/mewatch.sg.channels.xml b/sites/mewatch.sg/mewatch.sg.channels.xml index 0db4e147..1f94c90b 100644 --- a/sites/mewatch.sg/mewatch.sg.channels.xml +++ b/sites/mewatch.sg/mewatch.sg.channels.xml @@ -4,17 +4,23 @@ Channel 5 Channel 8 Channel U + CinemaWorld Cinemax CNA - eGG Network GEM + Global Trekker HBO HBO Family HBO Hits HBO Signature LIVE 1 LIVE 2 + LIVE 5 + LIVE+ 1 oktolidays + ROCK Action + ROCK Entertainment + SPL01 Suria Vasantham diff --git a/sites/mewatch.sg/mewatch.sg.config.js b/sites/mewatch.sg/mewatch.sg.config.js index bb029050..e8f8bff6 100644 --- a/sites/mewatch.sg/mewatch.sg.config.js +++ b/sites/mewatch.sg/mewatch.sg.config.js @@ -26,6 +26,30 @@ module.exports = { }) return programs + }, + async channels() { + const axios = require('axios') + const cheerio = require('cheerio') + const data = await axios + .get(`https://www.mewatch.sg/channel-guide`) + .then(r => r.data) + .catch(console.log) + + let channels = [] + const $ = cheerio.load(data) + $('#side-nav > div > div > div > nav:nth-child(1) > ul > li > ul > li').each((i, el) => { + const name = $(el).find('a > span').text() + const url = $(el).find('a').attr('href') + const [, site_id] = url.match(/\/(\d+)\?player-fullscreen/) + + channels.push({ + lang: 'en', + name, + site_id + }) + }) + + return channels } } diff --git a/sites/mewatch.sg/mewatch.sg.test.js b/sites/mewatch.sg/mewatch.sg.test.js index fdc6f9c3..9cbe34cf 100644 --- a/sites/mewatch.sg/mewatch.sg.test.js +++ b/sites/mewatch.sg/mewatch.sg.test.js @@ -1,3 +1,4 @@ +// npm run channels:parse -- --config=./sites/mewatch.sg/mewatch.sg.config.js --output=./sites/mewatch.sg/mewatch.sg.channels.xml // npm run grab -- --site=mewatch.sg const { parser, url } = require('./mewatch.sg.config.js')