mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update tvpassport.com
This commit is contained in:
parent
47376f20de
commit
571b77b481
4 changed files with 12140 additions and 626 deletions
21
sites/tvpassport.com/readme.md
Normal file
21
sites/tvpassport.com/readme.md
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# tvpassport.com
|
||||||
|
|
||||||
|
https://www.tvpassport.com/tv-listings
|
||||||
|
|
||||||
|
### Download the guide
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run grab -- --site=tvpassport.com
|
||||||
|
```
|
||||||
|
|
||||||
|
### Update channel list
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run channels:parse -- --config=./sites/tvpassport.com/tvpassport.com.config.js --output=./sites/tvpassport.com/tvpassport.com.channels.xml
|
||||||
|
```
|
||||||
|
|
||||||
|
### Test
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm test -- tvpassport.com
|
||||||
|
```
|
File diff suppressed because it is too large
Load diff
|
@ -55,30 +55,46 @@ module.exports = {
|
||||||
return programs
|
return programs
|
||||||
},
|
},
|
||||||
async channels() {
|
async channels() {
|
||||||
const content = await axios
|
const xml = await axios
|
||||||
.get('https://www.tvpassport.com/tv-listings', {
|
.get('https://www.tvpassport.com/sitemap.stations.xml')
|
||||||
headers: {
|
|
||||||
Cookie: 'cisession=317b3a464bfe449650b7cc4b16ccf900a6646d88;'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(r => r.data)
|
.then(r => r.data)
|
||||||
.catch(console.log)
|
.catch(console.error)
|
||||||
const $ = cheerio.load(content)
|
|
||||||
|
|
||||||
return $('.channel_cell')
|
let channels = []
|
||||||
.map((i, el) => {
|
|
||||||
const site_id = $(el)
|
|
||||||
.find('a')
|
|
||||||
.attr('href')
|
|
||||||
.replace('https://www.tvpassport.com/tv-listings/stations/', '')
|
|
||||||
const name = $(el).find('.sr-only').text().trim()
|
|
||||||
|
|
||||||
return {
|
const $ = cheerio.load(xml)
|
||||||
site_id,
|
|
||||||
name
|
const elements = $('loc').toArray()
|
||||||
}
|
|
||||||
|
let total = elements.length
|
||||||
|
let i = 1
|
||||||
|
for (let el of elements) {
|
||||||
|
const url = $(el).text()
|
||||||
|
const [, site_id] = url.match(/\/tv\-listings\/stations\/(.*)$/)
|
||||||
|
|
||||||
|
console.log(`[${i}/${total}]`, url)
|
||||||
|
|
||||||
|
const channelPage = await axios
|
||||||
|
.get(url)
|
||||||
|
.then(r => r.data)
|
||||||
|
.catch(err => console.error(err.message))
|
||||||
|
|
||||||
|
if (!channelPage) continue
|
||||||
|
|
||||||
|
const $channelPage = cheerio.load(channelPage)
|
||||||
|
const title = $channelPage('meta[property="og:title"]').attr('content')
|
||||||
|
const name = title.replace('TV Schedule for ', '')
|
||||||
|
|
||||||
|
channels.push({
|
||||||
|
lang: 'en',
|
||||||
|
site_id,
|
||||||
|
name
|
||||||
})
|
})
|
||||||
.get()
|
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
|
||||||
|
return channels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
// npm run grab -- --site=tvpassport.com
|
|
||||||
// npm run channels:parse -- --config=./sites/tvpassport.com/tvpassport.com.config.js --output=./sites/tvpassport.com/tvpassport.com.channels.xml
|
|
||||||
|
|
||||||
const { parser, url, request } = require('./tvpassport.com.config.js')
|
const { parser, url, request } = require('./tvpassport.com.config.js')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue