Upgrade to last version of iptv-playlist-parser

This commit is contained in:
freearhey 2019-10-07 04:15:27 +03:00
parent f8c956ad40
commit 5947ccf4a6
4 changed files with 8 additions and 11 deletions

View File

@ -69,7 +69,7 @@ async function main() {
} }
} }
const epgUrl = playlist.attrs['x-tvg-url'] const epgUrl = playlist.header.attrs['x-tvg-url']
if(epgUrl && !buffer[epgUrl] && parseEpg) { if(epgUrl && !buffer[epgUrl] && parseEpg) {
console.log(`Loading '${epgUrl}'...`) console.log(`Loading '${epgUrl}'...`)
const epg = await util.loadEPG(epgUrl) const epg = await util.loadEPG(epgUrl)

View File

@ -18,17 +18,14 @@ let cache = {}
class Playlist { class Playlist {
constructor(data) { constructor(data) {
this.attrs = { this.header = data.header
'x-tvg-url': data.tvg.url
}
this.items = data.items this.items = data.items
} }
getHeader() { getHeader() {
let parts = ['#EXTM3U'] let parts = ['#EXTM3U']
for(let key in this.attrs) { for(let key in this.header.attrs) {
let value = this.attrs[key] let value = this.header.attrs[key]
if(value) { if(value) {
parts.push(`${key}="${value}"`) parts.push(`${key}="${value}"`)
} }

6
package-lock.json generated
View File

@ -32,9 +32,9 @@
} }
}, },
"iptv-playlist-parser": { "iptv-playlist-parser": {
"version": "0.1.2", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/iptv-playlist-parser/-/iptv-playlist-parser-0.1.2.tgz", "resolved": "https://registry.npmjs.org/iptv-playlist-parser/-/iptv-playlist-parser-0.2.0.tgz",
"integrity": "sha512-CItFULezZv3o+RANgZDXiVWqEBDtzCXn6YkTBzsWyxnYV/oOyzDsN2xMJ2U/a0CHIXzY3NZ+KNP7+VbcAI2DBQ==", "integrity": "sha512-qPWX9ou6SKOROnPk/zjXFekzJbWq+Q/5h6bkIOMWiRM+/P5SxY2e5N845I1nwWP5DvqlGaEGuGaX1xCjpOpO6w==",
"dev": true, "dev": true,
"requires": { "requires": {
"m3u8-file-parser": "^0.2.1" "m3u8-file-parser": "^0.2.1"

View File

@ -11,7 +11,7 @@
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"axios": ">=0.18.1", "axios": ">=0.18.1",
"iptv-playlist-parser": "^0.1.2", "iptv-playlist-parser": "^0.2.0",
"xmldom": "^0.1.27" "xmldom": "^0.1.27"
} }
} }