mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 17:10:07 -04:00
Merge pull request #428 from iptv-org/update-directv-com-2
Update directv.com
This commit is contained in:
commit
d34f2fabfc
2 changed files with 29 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
|||
const { padStart } = require('lodash')
|
||||
const cheerio = require('cheerio')
|
||||
const axios = require('axios')
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
|
@ -34,6 +36,32 @@ module.exports = {
|
|||
}
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels({ country }) {
|
||||
const html = await axios
|
||||
.get(`https://www.directv.com/guide`)
|
||||
.then(r => r.data)
|
||||
.catch(console.log)
|
||||
|
||||
const $ = cheerio.load(html)
|
||||
const script = $('#dtvClientData').html()
|
||||
const [_, json] = script.match(/var dtvClientData = (.*);/) || [null, null]
|
||||
const data = JSON.parse(json)
|
||||
|
||||
let items = data.guideData.channels
|
||||
|
||||
return items.map(item => {
|
||||
return {
|
||||
lang: 'en',
|
||||
site_id: item.chNum,
|
||||
name: item.chName,
|
||||
logo: `https://www.directv.com/images/logos/channels/dark/large/${padStart(
|
||||
item.chLogoId,
|
||||
3,
|
||||
'0'
|
||||
)}.png`
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// node ./scripts/commands/parse-channels.js --config=./sites/directv.com/directv.com.config.js --output=./sites/directv.com/directv.com_us.channels.xml
|
||||
// npx epg-grabber --config=sites/directv.com/directv.com.config.js --channels=sites/directv.com/directv.com_us.channels.xml --output=guide.xml --days=2
|
||||
|
||||
const { parser, url, logo } = require('./directv.com.config.js')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue