Replace LF line endings with CRLF

This commit is contained in:
freearhey
2025-09-28 17:55:05 +03:00
parent efc74efcf8
commit b6a589c62a
1192 changed files with 445631 additions and 445631 deletions

View File

@@ -1,21 +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
```
# 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
```

View File

@@ -1,80 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<channels>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="648">ST SPORTS PREMIUM HD</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="708">ETV SA</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="709">ST MOVIES</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="166494172">GANZA TV</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="168556647">ST NOVELA E</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="257840078">MAKULA TV</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="301153275">RT FRANCE</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="343829804">ST Swahili Plus</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="426003040">FILMBOX ACTION</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="617598439">CBS JUSTICE</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="1031981242">ST SPORTS ARENA HD</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="1241908189">ST MANIA</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="1291168734">Bliss TV</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="1326109225">ST AFRIK</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="1502604813">ST TOONS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="1868819766">ST Beta Sports</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="1935265459">REAL MADRID TV</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="2067533458">REMBO PLUS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="AfricanMovieChannel.uk" site_id="1023149121">AMC MOVIES</channel>
<channel site="startimestv.com" lang="en" xmltv_id="AfroNovelas.fr" site_id="1853457481">Afro Novelas</channel>
<channel site="startimestv.com" lang="en" xmltv_id="AITNational.ng" site_id="224">AIT</channel>
<channel site="startimestv.com" lang="en" xmltv_id="AlJazeera.qa@English" site_id="217">AL JAZEERA</channel>
<channel site="startimestv.com" lang="en" xmltv_id="Arewa24.ng" site_id="91844309">AREWA 24</channel>
<channel site="startimestv.com" lang="en" xmltv_id="BabyTV.uk" site_id="219">BABY TV</channel>
<channel site="startimestv.com" lang="en" xmltv_id="BBCNews.uk@Africa" site_id="139">BBC WORLD NEWS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="BloombergTV.us@Africa" site_id="140">BLOOMBERG</channel>
<channel site="startimestv.com" lang="en" xmltv_id="Boomerang.fr" site_id="432">Boomerang</channel>
<channel site="startimestv.com" lang="en" xmltv_id="CGTN.cn" site_id="216">CGTN</channel>
<channel site="startimestv.com" lang="en" xmltv_id="CGTNDocumentary.cn" site_id="339">CGTN DOC</channel>
<channel site="startimestv.com" lang="en" xmltv_id="Colors.in" site_id="1529033737">COLORS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="DaVinci.de" site_id="240">DA VINCI</channel>
<channel site="startimestv.com" lang="en" xmltv_id="ESPN2Africa.za" site_id="151">ESPN 2</channel>
<channel site="startimestv.com" lang="en" xmltv_id="ESPNAfrica.za" site_id="150">ESPN</channel>
<channel site="startimestv.com" lang="en" xmltv_id="Fox.pt" site_id="596">STAR CHANNEL</channel>
<channel site="startimestv.com" lang="en" xmltv_id="FUELTV.at" site_id="393">FUEL TV</channel>
<channel site="startimestv.com" lang="en" xmltv_id="JimJamMEA.uk" site_id="127">JIMJAM</channel>
<channel site="startimestv.com" lang="en" xmltv_id="MamboTVSwahili.tz" site_id="1971078972">MAMBO TV</channel>
<channel site="startimestv.com" lang="en" xmltv_id="NationalGeographicSouthAfrica.za" site_id="629">NGC</channel>
<channel site="startimestv.com" lang="en" xmltv_id="PhoenixInfoNewsChannel.hk" site_id="421">Phoenix Info</channel>
<channel site="startimestv.com" lang="en" xmltv_id="PremiumBoxOffice.cn" site_id="1900548203">PBO</channel>
<channel site="startimestv.com" lang="en" xmltv_id="StarLifeAfrica.in" site_id="1487976954">STAR LIFE</channel>
<channel site="startimestv.com" lang="en" xmltv_id="StarPlus.in" site_id="168">STAR PLUS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STChineseHomeland.cn" site_id="719">中国影视</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STDadinKowa.cn" site_id="159">ST DADIN KOWA</channel>
<channel site="startimestv.com" lang="en" xmltv_id="StingrayClassica.ca" site_id="394">Classica</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STKids.cn" site_id="822761104">ST KIDS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STKungfu.cn" site_id="455">ST KUNGFU</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STMoviesPlus.cn" site_id="166">ST MOVIES PLUS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STNollywoodPlus.cn" site_id="1572293892">ST NOLLYWOOD PLUS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STNovelaE.cn" site_id="92">ST NOVELA E</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STNovelaEPlus.cn" site_id="697">ST NOVELA E PLUS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STSinoDrama.cn" site_id="456">ST SINO DRAMA</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STSportsArena.cn" site_id="445">ST SPORTS ARENA</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STSportsFocus.cn" site_id="266">ST SPORTS FOCUS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STSportsLife.cn" site_id="443">ST SPORTS LIFE</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STSportsPremium.cn" site_id="302">ST SPORTS PREMIUM</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STSwahili.cn" site_id="265">ST SWAHILI</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STWorldFootball.cn" site_id="649">ST WORLD FOOTBALL HD</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STYoruba.cn" site_id="598">ST YORUBA</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STZone.cn" site_id="293">ST ZONE</channel>
<channel site="startimestv.com" lang="en" xmltv_id="TCMCinema.fr" site_id="460">TCM</channel>
<channel site="startimestv.com" lang="en" xmltv_id="Toonami.fr" site_id="1901544600">WARNER TV NEXT</channel>
<channel site="startimestv.com" lang="en" xmltv_id="ToonamiAfrica.us" site_id="1840186488">TOONAMI</channel>
<channel site="startimestv.com" lang="en" xmltv_id="WarnerTV.fr" site_id="464072645">WARNER TV</channel>
<channel site="startimestv.com" lang="en" xmltv_id="WSport.za" site_id="1296220504">W-Sport</channel>
<channel site="startimestv.com" lang="en" xmltv_id="ZeeMagic.fr" site_id="1021478122">ZEE MAGIC</channel>
<channel site="startimestv.com" lang="en" xmltv_id="ZeeOneAfrica.za" site_id="1023102509">ZEE ONE</channel>
<channel site="startimestv.com" lang="fr" xmltv_id="CGTNFrench.cn" site_id="500">CGTN F</channel>
<channel site="startimestv.com" lang="fr" xmltv_id="STNovelaF1.cn" site_id="402">ST NOVELA F</channel>
<channel site="startimestv.com" lang="fr" xmltv_id="STNovelaFPlus.cn" site_id="698">ST NOVELA F PLUS</channel>
<channel site="startimestv.com" lang="fr" xmltv_id="TV5MondeAfrica.fr" site_id="381">TV5 MONDE</channel>
<channel site="startimestv.com" lang="pt" xmltv_id="" site_id="514">Afro Music</channel>
<channel site="startimestv.com" lang="pt" xmltv_id="AMCEurope.uk@Portugal" site_id="595">AMC P</channel>
<channel site="startimestv.com" lang="pt" xmltv_id="DisneyChannel.pt" site_id="512">DISNEY CHANNEL</channel>
<channel site="startimestv.com" lang="pt" xmltv_id="DisneyJunior.pt" site_id="513">DISNEY JUNIOR</channel>
<channel site="startimestv.com" lang="pt" xmltv_id="STNovelaP.cn" site_id="1510725361">ST NOVELA P</channel>
<channel site="startimestv.com" lang="pt" xmltv_id="TLNNetwork.mx" site_id="582">TLN</channel>
</channels>
<?xml version="1.0" encoding="UTF-8"?>
<channels>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="648">ST SPORTS PREMIUM HD</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="708">ETV SA</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="709">ST MOVIES</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="166494172">GANZA TV</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="168556647">ST NOVELA E</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="257840078">MAKULA TV</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="301153275">RT FRANCE</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="343829804">ST Swahili Plus</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="426003040">FILMBOX ACTION</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="617598439">CBS JUSTICE</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="1031981242">ST SPORTS ARENA HD</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="1241908189">ST MANIA</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="1291168734">Bliss TV</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="1326109225">ST AFRIK</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="1502604813">ST TOONS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="1868819766">ST Beta Sports</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="1935265459">REAL MADRID TV</channel>
<channel site="startimestv.com" lang="en" xmltv_id="" site_id="2067533458">REMBO PLUS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="AfricanMovieChannel.uk" site_id="1023149121">AMC MOVIES</channel>
<channel site="startimestv.com" lang="en" xmltv_id="AfroNovelas.fr" site_id="1853457481">Afro Novelas</channel>
<channel site="startimestv.com" lang="en" xmltv_id="AITNational.ng" site_id="224">AIT</channel>
<channel site="startimestv.com" lang="en" xmltv_id="AlJazeera.qa@English" site_id="217">AL JAZEERA</channel>
<channel site="startimestv.com" lang="en" xmltv_id="Arewa24.ng" site_id="91844309">AREWA 24</channel>
<channel site="startimestv.com" lang="en" xmltv_id="BabyTV.uk" site_id="219">BABY TV</channel>
<channel site="startimestv.com" lang="en" xmltv_id="BBCNews.uk@Africa" site_id="139">BBC WORLD NEWS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="BloombergTV.us@Africa" site_id="140">BLOOMBERG</channel>
<channel site="startimestv.com" lang="en" xmltv_id="Boomerang.fr" site_id="432">Boomerang</channel>
<channel site="startimestv.com" lang="en" xmltv_id="CGTN.cn" site_id="216">CGTN</channel>
<channel site="startimestv.com" lang="en" xmltv_id="CGTNDocumentary.cn" site_id="339">CGTN DOC</channel>
<channel site="startimestv.com" lang="en" xmltv_id="Colors.in" site_id="1529033737">COLORS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="DaVinci.de" site_id="240">DA VINCI</channel>
<channel site="startimestv.com" lang="en" xmltv_id="ESPN2Africa.za" site_id="151">ESPN 2</channel>
<channel site="startimestv.com" lang="en" xmltv_id="ESPNAfrica.za" site_id="150">ESPN</channel>
<channel site="startimestv.com" lang="en" xmltv_id="Fox.pt" site_id="596">STAR CHANNEL</channel>
<channel site="startimestv.com" lang="en" xmltv_id="FUELTV.at" site_id="393">FUEL TV</channel>
<channel site="startimestv.com" lang="en" xmltv_id="JimJamMEA.uk" site_id="127">JIMJAM</channel>
<channel site="startimestv.com" lang="en" xmltv_id="MamboTVSwahili.tz" site_id="1971078972">MAMBO TV</channel>
<channel site="startimestv.com" lang="en" xmltv_id="NationalGeographicSouthAfrica.za" site_id="629">NGC</channel>
<channel site="startimestv.com" lang="en" xmltv_id="PhoenixInfoNewsChannel.hk" site_id="421">Phoenix Info</channel>
<channel site="startimestv.com" lang="en" xmltv_id="PremiumBoxOffice.cn" site_id="1900548203">PBO</channel>
<channel site="startimestv.com" lang="en" xmltv_id="StarLifeAfrica.in" site_id="1487976954">STAR LIFE</channel>
<channel site="startimestv.com" lang="en" xmltv_id="StarPlus.in" site_id="168">STAR PLUS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STChineseHomeland.cn" site_id="719">中国影视</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STDadinKowa.cn" site_id="159">ST DADIN KOWA</channel>
<channel site="startimestv.com" lang="en" xmltv_id="StingrayClassica.ca" site_id="394">Classica</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STKids.cn" site_id="822761104">ST KIDS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STKungfu.cn" site_id="455">ST KUNGFU</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STMoviesPlus.cn" site_id="166">ST MOVIES PLUS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STNollywoodPlus.cn" site_id="1572293892">ST NOLLYWOOD PLUS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STNovelaE.cn" site_id="92">ST NOVELA E</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STNovelaEPlus.cn" site_id="697">ST NOVELA E PLUS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STSinoDrama.cn" site_id="456">ST SINO DRAMA</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STSportsArena.cn" site_id="445">ST SPORTS ARENA</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STSportsFocus.cn" site_id="266">ST SPORTS FOCUS</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STSportsLife.cn" site_id="443">ST SPORTS LIFE</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STSportsPremium.cn" site_id="302">ST SPORTS PREMIUM</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STSwahili.cn" site_id="265">ST SWAHILI</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STWorldFootball.cn" site_id="649">ST WORLD FOOTBALL HD</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STYoruba.cn" site_id="598">ST YORUBA</channel>
<channel site="startimestv.com" lang="en" xmltv_id="STZone.cn" site_id="293">ST ZONE</channel>
<channel site="startimestv.com" lang="en" xmltv_id="TCMCinema.fr" site_id="460">TCM</channel>
<channel site="startimestv.com" lang="en" xmltv_id="Toonami.fr" site_id="1901544600">WARNER TV NEXT</channel>
<channel site="startimestv.com" lang="en" xmltv_id="ToonamiAfrica.us" site_id="1840186488">TOONAMI</channel>
<channel site="startimestv.com" lang="en" xmltv_id="WarnerTV.fr" site_id="464072645">WARNER TV</channel>
<channel site="startimestv.com" lang="en" xmltv_id="WSport.za" site_id="1296220504">W-Sport</channel>
<channel site="startimestv.com" lang="en" xmltv_id="ZeeMagic.fr" site_id="1021478122">ZEE MAGIC</channel>
<channel site="startimestv.com" lang="en" xmltv_id="ZeeOneAfrica.za" site_id="1023102509">ZEE ONE</channel>
<channel site="startimestv.com" lang="fr" xmltv_id="CGTNFrench.cn" site_id="500">CGTN F</channel>
<channel site="startimestv.com" lang="fr" xmltv_id="STNovelaF1.cn" site_id="402">ST NOVELA F</channel>
<channel site="startimestv.com" lang="fr" xmltv_id="STNovelaFPlus.cn" site_id="698">ST NOVELA F PLUS</channel>
<channel site="startimestv.com" lang="fr" xmltv_id="TV5MondeAfrica.fr" site_id="381">TV5 MONDE</channel>
<channel site="startimestv.com" lang="pt" xmltv_id="" site_id="514">Afro Music</channel>
<channel site="startimestv.com" lang="pt" xmltv_id="AMCEurope.uk@Portugal" site_id="595">AMC P</channel>
<channel site="startimestv.com" lang="pt" xmltv_id="DisneyChannel.pt" site_id="512">DISNEY CHANNEL</channel>
<channel site="startimestv.com" lang="pt" xmltv_id="DisneyJunior.pt" site_id="513">DISNEY JUNIOR</channel>
<channel site="startimestv.com" lang="pt" xmltv_id="STNovelaP.cn" site_id="1510725361">ST NOVELA P</channel>
<channel site="startimestv.com" lang="pt" xmltv_id="TLNNetwork.mx" site_id="582">TLN</channel>
</channels>

View File

@@ -1,112 +1,112 @@
const cheerio = require('cheerio')
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const customParseFormat = require('dayjs/plugin/customParseFormat')
const doFetch = require('@ntlab/sfetch')
const debug = require('debug')('site:startimestv.com')
dayjs.extend(utc)
dayjs.extend(customParseFormat)
doFetch.setDebugger(debug).setMaxWorker(5)
module.exports = {
site: 'startimestv.com',
days: 2,
url({ channel, date }) {
return `https://www.startimestv.com/channeldetail/${channel.site_id}/${date.format(
'YYYY-MM-DD'
)}.html`
},
parser({ content, date }) {
const programs = []
if (content) {
const $ = cheerio.load(content)
$('.box .mask')
.toArray()
.forEach(el => {
let title = parseText($(el).find('h4'))
const [s, e] = title.substr(0, title.indexOf(' ')).split('-') || [null, null]
const start = dayjs.utc(`${date.format('YYYY-MM-DD')} ${s}`, 'YYYY-MM-DD HH:nn')
const stop = dayjs.utc(`${date.format('YYYY-MM-DD')} ${e}`, 'YYYY-MM-DD HH:nn')
title = title.substr(title.indexOf(' ') + 1)
const [, season, episode] = title.match(/ S(\d+) E(\d+)/) || [null, null, null]
const description = parseText($(el).find('p'))
programs.push({
title,
description: description !== 'NA' ? description : null,
season: season ? parseInt(season) : season,
episode: episode ? parseInt(episode) : episode,
start,
stop
})
})
}
return programs
},
async channels() {
const channels = {}
const queues = [{ t: 'a', url: 'https://www.startimestv.com/tv_guide.html' }]
await doFetch(queues, (queue, res) => {
// process area-id
if (queue.t === 'a') {
const $ = cheerio.load(res)
$('dd.update-areaID')
.toArray()
.forEach(el => {
const dd = $(el)
const areaId = dd.attr('area-id')
queues.push({
t: 's',
url: 'https://www.startimestv.com/tv_guide.html',
params: {
headers: {
cookie: `default_areaID=${areaId}`
}
}
})
})
}
// process channel
if (queue.t === 's') {
if (res) {
const $ = cheerio.load(res)
$('.channl .c')
.toArray()
.forEach(el => {
// only process channel with schedule only
const clazz = $(el).attr('class')
const [idx] = clazz.match(/\d+/) || [null]
if (idx && $(`.item.item-${idx} .mask`).length) {
const ch = $(el).find('.pic a[title]')
const [site_id] = ch.attr('href').match(/\d+/) || [null]
if (channels[site_id] === undefined) {
channels[site_id] = {
lang: 'en',
name: ch.attr('title'),
site_id
}
}
}
})
}
}
})
return Object.values(channels)
}
}
function parseText($item) {
let text = $item.text().replace(/\t/g, '').replace(/\n/g, ' ').trim()
while (true) {
if (text.match(/\s\s/)) {
text = text.replace(/\s\s/g, ' ')
continue
}
break
}
return text
}
const cheerio = require('cheerio')
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const customParseFormat = require('dayjs/plugin/customParseFormat')
const doFetch = require('@ntlab/sfetch')
const debug = require('debug')('site:startimestv.com')
dayjs.extend(utc)
dayjs.extend(customParseFormat)
doFetch.setDebugger(debug).setMaxWorker(5)
module.exports = {
site: 'startimestv.com',
days: 2,
url({ channel, date }) {
return `https://www.startimestv.com/channeldetail/${channel.site_id}/${date.format(
'YYYY-MM-DD'
)}.html`
},
parser({ content, date }) {
const programs = []
if (content) {
const $ = cheerio.load(content)
$('.box .mask')
.toArray()
.forEach(el => {
let title = parseText($(el).find('h4'))
const [s, e] = title.substr(0, title.indexOf(' ')).split('-') || [null, null]
const start = dayjs.utc(`${date.format('YYYY-MM-DD')} ${s}`, 'YYYY-MM-DD HH:nn')
const stop = dayjs.utc(`${date.format('YYYY-MM-DD')} ${e}`, 'YYYY-MM-DD HH:nn')
title = title.substr(title.indexOf(' ') + 1)
const [, season, episode] = title.match(/ S(\d+) E(\d+)/) || [null, null, null]
const description = parseText($(el).find('p'))
programs.push({
title,
description: description !== 'NA' ? description : null,
season: season ? parseInt(season) : season,
episode: episode ? parseInt(episode) : episode,
start,
stop
})
})
}
return programs
},
async channels() {
const channels = {}
const queues = [{ t: 'a', url: 'https://www.startimestv.com/tv_guide.html' }]
await doFetch(queues, (queue, res) => {
// process area-id
if (queue.t === 'a') {
const $ = cheerio.load(res)
$('dd.update-areaID')
.toArray()
.forEach(el => {
const dd = $(el)
const areaId = dd.attr('area-id')
queues.push({
t: 's',
url: 'https://www.startimestv.com/tv_guide.html',
params: {
headers: {
cookie: `default_areaID=${areaId}`
}
}
})
})
}
// process channel
if (queue.t === 's') {
if (res) {
const $ = cheerio.load(res)
$('.channl .c')
.toArray()
.forEach(el => {
// only process channel with schedule only
const clazz = $(el).attr('class')
const [idx] = clazz.match(/\d+/) || [null]
if (idx && $(`.item.item-${idx} .mask`).length) {
const ch = $(el).find('.pic a[title]')
const [site_id] = ch.attr('href').match(/\d+/) || [null]
if (channels[site_id] === undefined) {
channels[site_id] = {
lang: 'en',
name: ch.attr('title'),
site_id
}
}
}
})
}
}
})
return Object.values(channels)
}
}
function parseText($item) {
let text = $item.text().replace(/\t/g, '').replace(/\n/g, ' ').trim()
while (true) {
if (text.match(/\s\s/)) {
text = text.replace(/\s\s/g, ' ')
continue
}
break
}
return text
}

View File

@@ -1,48 +1,48 @@
const { parser, url } = require('./startimestv.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('2024-12-10', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: '1023102509',
xmltv_id: 'ZeeOneAfrica.za'
}
it('can generate valid url', () => {
expect(url({ channel, date })).toBe(
'https://www.startimestv.com/channeldetail/1023102509/2024-12-10.html'
)
})
it('can parse response', () => {
const fs = require('fs')
const path = require('path')
const content = fs.readFileSync(path.join(__dirname, '__data__', 'content.html'))
const result = parser({ content, date }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(result.length).toBe(22)
expect(result[0]).toMatchObject({
start: '2024-12-10T00:00:00.000Z',
stop: '2024-12-10T01:00:00.000Z',
title: 'Deserted S1 E37',
description:
'Tora approaches Tubri for help, but she expresses her helplessness in seeking assistance from Arjun. Meanwhile, other family members are caught in the crossfire, trying to navigate their own positions within the household.',
season: 1,
episode: 37
})
})
it('can handle empty guide', () => {
const result = parser({
content:
'<!DOCTYPE html><html> <body> <div id="body" class="page"> <div class="block"> <div class="channel"> <div class="title1"> <h3 style="text-transform:uppercase;"></h3> </div><div class="content"> <div class="des" style="background-color:#FFAB00"> <div class="sdw"></div><div class="inner clearfix"> <div class="pic"> <img src="" onerror="onerror=null;src=\'/Public/static/images/channellogo.png\'"> </div><div class="inf"> <h3 style="text-transform:uppercase;"></h3> <div class="num"> </div><div class="box"> <p class="rate" data="">Rate: <i></i><i></i><i></i><i></i><i></i></p><p>Category: </p><br/> </div></div><div class="txt"> <p></p></div></div></div></div></div></div></div></body></html>'
})
expect(result).toMatchObject([])
})
const { parser, url } = require('./startimestv.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('2024-12-10', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: '1023102509',
xmltv_id: 'ZeeOneAfrica.za'
}
it('can generate valid url', () => {
expect(url({ channel, date })).toBe(
'https://www.startimestv.com/channeldetail/1023102509/2024-12-10.html'
)
})
it('can parse response', () => {
const fs = require('fs')
const path = require('path')
const content = fs.readFileSync(path.join(__dirname, '__data__', 'content.html'))
const result = parser({ content, date }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(result.length).toBe(22)
expect(result[0]).toMatchObject({
start: '2024-12-10T00:00:00.000Z',
stop: '2024-12-10T01:00:00.000Z',
title: 'Deserted S1 E37',
description:
'Tora approaches Tubri for help, but she expresses her helplessness in seeking assistance from Arjun. Meanwhile, other family members are caught in the crossfire, trying to navigate their own positions within the household.',
season: 1,
episode: 37
})
})
it('can handle empty guide', () => {
const result = parser({
content:
'<!DOCTYPE html><html> <body> <div id="body" class="page"> <div class="block"> <div class="channel"> <div class="title1"> <h3 style="text-transform:uppercase;"></h3> </div><div class="content"> <div class="des" style="background-color:#FFAB00"> <div class="sdw"></div><div class="inner clearfix"> <div class="pic"> <img src="" onerror="onerror=null;src=\'/Public/static/images/channellogo.png\'"> </div><div class="inf"> <h3 style="text-transform:uppercase;"></h3> <div class="num"> </div><div class="box"> <p class="rate" data="">Rate: <i></i><i></i><i></i><i></i><i></i></p><p>Category: </p><br/> </div></div><div class="txt"> <p></p></div></div></div></div></div></div></div></body></html>'
})
expect(result).toMatchObject([])
})