From 32b9199469f17f70e22e23452453248fabf96dbf Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Mon, 27 Nov 2023 20:41:06 +0300 Subject: [PATCH] Update startimestv.com --- sites/startimestv.com/readme.md | 21 ++++ .../startimestv.com.channels.xml | 106 ++++++++++++++---- .../startimestv.com/startimestv.com.config.js | 67 +++++------ sites/startimestv.com/startimestv.com.test.js | 3 - 4 files changed, 135 insertions(+), 62 deletions(-) create mode 100644 sites/startimestv.com/readme.md diff --git a/sites/startimestv.com/readme.md b/sites/startimestv.com/readme.md new file mode 100644 index 00000000..021f3708 --- /dev/null +++ b/sites/startimestv.com/readme.md @@ -0,0 +1,21 @@ +# startimestv.com + +https://startimestv.com/tv_guide.html + +### Download the guide + +```sh +npm run grab -- --site=startimestv.com +``` + +### Update channel list + +```sh +npm run channels:parse -- --config=./sites/startimestv.com/startimestv.com.config.js --output=./sites/startimestv.com/startimestv.com.channels.xml +``` + +### Test + +```sh +npm test -- startimestv.com +``` diff --git a/sites/startimestv.com/startimestv.com.channels.xml b/sites/startimestv.com/startimestv.com.channels.xml index 6f6145cc..b61f430b 100644 --- a/sites/startimestv.com/startimestv.com.channels.xml +++ b/sites/startimestv.com/startimestv.com.channels.xml @@ -1,7 +1,71 @@ - - + 2STV 3STONES.TV Adom TV @@ -40,24 +104,20 @@ BRAZZERS TV BTN RWA BTV Kenya - BTV Rwanda Bukedde TV Bukedde 2 Bunyoro TV BURKINA INFO BUSINESS 24 - CANAL2 INTERNATIONAL CANAL2 MOVIES CANAL J Cartoon Network CBEEBIES CCTV 1 - CCTV 13 CCTV 4 - CCTV 5 - CCTV 5+ CCTV 6 CCTV 9 + CCTV 13 CCTV 娱乐 CGTN CGTN DOCUMENTARY @@ -73,7 +133,7 @@ CNC WORLD CNN CNN PORTUGAL - COLORS + Colors CRTV CTI Asia DA VINCI @@ -82,19 +142,18 @@ DISCOVERY SCI. F DISNEY CHANNEL Disney Junior - TDC DOVE TV 东方卫视 DREAMIN DREAMWORKS DRTV DW + E!F E! EATV EBONY LIFE EBRU AFRICA ECCLESIA TV - E!F elimu TV EMCI TV EMMANUEL TV @@ -109,18 +168,18 @@ Family TV FARIN WATA FASHIONBOX + FOX P FOX LIFE FOX NEWS - FOX P France 2 - FRANCE 24 E - FRANCE 24 France 3 FRANCE 5 - Fuel TV + FRANCE 24 E + FRANCE 24 + FUEL TV GABON TÉLÉVISION GALAXY tv - GasyStar + GASYSTAR TV GHANA TV GLOW TV GOD @@ -153,6 +212,7 @@ KTN KTN NEWS KTO + MINDSET LEARN Liberty LMTV LOLWE TV @@ -168,7 +228,6 @@ MEGA TV MELODY DAFRIQUE MIKUBA TV - MINDSET LEARN Moliere Tv MSNBC MUTV @@ -204,7 +263,7 @@ ORTM ORTM 2 OUEST TV - PASSIONS TV + PASSION NOVELAS PENTHOUSE BLACK 凤凰CNE Phoenix Info @@ -283,26 +342,27 @@ TBC 2 TBN YETU TCM + TELE 7 Tele 50 - Télé7 TELECONGO TELE CHAD TFX 天津卫视 + TDC Times TV TIVI5 MONDE TLN TNT AFRICA + WARNER TV NEXT TOONAMI - TOONAMI F TRACE MZIKI Tumaini TV TV1 - TV 10 - TV3 Tanzania TV3 Ghana + TV3 Tanzania TV5 MONDE STYLE TV + TV 10 ALBAYAN TV TVB DRAMA TV BREIZH @@ -311,8 +371,8 @@ TVC NEWS TVI INTERNATIONAL TV Imaan - TVM1 TVM2 + TVM1 TVM TV MANA MIRAMAR @@ -324,7 +384,7 @@ UBC UBIZNEWS UTV - URBAN TV + TEN URBAN VISION 4 VOX AFRICA WanLuo TV diff --git a/sites/startimestv.com/startimestv.com.config.js b/sites/startimestv.com/startimestv.com.config.js index 8944afc8..e7434dd2 100644 --- a/sites/startimestv.com/startimestv.com.config.js +++ b/sites/startimestv.com/startimestv.com.config.js @@ -32,43 +32,38 @@ module.exports = { return programs }, - async channels({ country }) { - const area = { - ke: 6, - ng: 2, - tz: 3, - ug: 4, - rw: 5, - gh: 32, - mw: 14, - ci: 22, - gn: 12, - bi: 9, - cg: 16, - cd: 11, - mg: 13, - mz: 15, - cm: 20, - ga: 19 - } - const data = await axios - .get('https://www.startimestv.com/tv_guide.html', { - headers: { - Cookie: `default_areaID=${area[country]}` - } - }) - .then(r => r.data) - .catch(console.log) - const $ = cheerio.load(data) - const script = $('body > script:nth-child(10)').html() - let [, json] = script.match(/var obj = eval\( '(.*)' \);/) || [null, null] - json = json.replace(/\\'/g, '') - const items = JSON.parse(json) + async channels() { + const _ = require('lodash') - return items.map(i => ({ - name: i.name, - site_id: i.id - })) + const areas = [6, 2, 3, 4, 5, 32, 14, 22, 12, 9, 16, 11, 13, 15, 20, 19] + + const channels = [] + for (let area of areas) { + const data = await axios + .get('https://www.startimestv.com/tv_guide.html', { + headers: { + Cookie: `default_areaID=${area}` + } + }) + .then(r => r.data) + .catch(console.log) + + const $ = cheerio.load(data) + const script = $('body > script:nth-child(10)').html() + let [, json] = script.match(/var obj = eval\( '(.*)' \);/) || [null, null] + json = json.replace(/\\'/g, '') + const items = JSON.parse(json) + + items.forEach(item => { + channels.push({ + lang: 'en', + name: item.name, + site_id: item.id + }) + }) + } + + return _.uniqBy(channels, 'site_id') } } diff --git a/sites/startimestv.com/startimestv.com.test.js b/sites/startimestv.com/startimestv.com.test.js index a11aecda..02da6098 100644 --- a/sites/startimestv.com/startimestv.com.test.js +++ b/sites/startimestv.com/startimestv.com.test.js @@ -1,6 +1,3 @@ -// npm run channels:parse -- --config=./sites/startimestv.com/startimestv.com.config.js --output=./sites/startimestv.com/startimestv.com.channels.xml --set=country:ke -// npm run grab -- --site=startimestv.com - const { parser, url } = require('./startimestv.com.config.js') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc')