mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-13 18:40:05 -04:00
Added support for #EXTVLCOPT:http-referrer and #EXTVLCOPT:http-user-agent stream options
This commit is contained in:
parent
7fb06b43d7
commit
80cbff843c
1 changed files with 28 additions and 17 deletions
|
@ -175,15 +175,7 @@ helper.generateTable = function (data, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
helper.createChannel = function (data) {
|
helper.createChannel = function (data) {
|
||||||
return new Channel({
|
return new Channel(data)
|
||||||
id: data.tvg.id,
|
|
||||||
name: data.tvg.name,
|
|
||||||
language: data.tvg.language,
|
|
||||||
logo: data.tvg.logo,
|
|
||||||
group: data.group.title,
|
|
||||||
url: data.url,
|
|
||||||
title: data.name
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
helper.writeToLog = function (country, msg, url) {
|
helper.writeToLog = function (country, msg, url) {
|
||||||
|
@ -230,13 +222,15 @@ class Playlist {
|
||||||
|
|
||||||
class Channel {
|
class Channel {
|
||||||
constructor(data) {
|
constructor(data) {
|
||||||
this.id = data.id
|
this.id = data.tvg.id
|
||||||
this.name = data.name
|
this.name = data.tvg.name
|
||||||
this.language = this._filterLanguage(data.language)
|
this.language = this._filterLanguage(data.tvg.language)
|
||||||
this.logo = data.logo
|
this.logo = data.tvg.logo
|
||||||
this.group = this._filterGroup(data.group)
|
this.group = this._filterGroup(data.group.title)
|
||||||
this.url = data.url
|
this.url = data.url
|
||||||
this.title = data.title
|
this.title = data.name.trim()
|
||||||
|
this.userAgent = data.http['user-agent']
|
||||||
|
this.referrer = data.http['referrer']
|
||||||
}
|
}
|
||||||
|
|
||||||
_filterGroup(groupTitle) {
|
_filterGroup(groupTitle) {
|
||||||
|
@ -297,13 +291,30 @@ class Channel {
|
||||||
toString() {
|
toString() {
|
||||||
const country = this.countryCode.toUpperCase()
|
const country = this.countryCode.toUpperCase()
|
||||||
const epg = this.id && this.epg ? this.epg : ''
|
const epg = this.id && this.epg ? this.epg : ''
|
||||||
const info = `-1 tvg-id="${this.id}" tvg-name="${this.name}" tvg-language="${this.language}" tvg-logo="${this.logo}" tvg-country="${country}" tvg-url="${epg}" group-title="${this.group}",${this.title}`
|
|
||||||
|
let info = `-1 tvg-id="${this.id}" tvg-name="${this.name}" tvg-language="${this.language}" tvg-logo="${this.logo}" tvg-country="${country}" tvg-url="${epg}" group-title="${this.group}",${this.title}`
|
||||||
|
|
||||||
|
if (this.referrer) {
|
||||||
|
info += `\n#EXTVLCOPT:http-referrer=${this.referrer}`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.userAgent) {
|
||||||
|
info += `\n#EXTVLCOPT:http-user-agent=${this.userAgent}`
|
||||||
|
}
|
||||||
|
|
||||||
return '#EXTINF:' + info + '\n' + this.url + '\n'
|
return '#EXTINF:' + info + '\n' + this.url + '\n'
|
||||||
}
|
}
|
||||||
|
|
||||||
toShortString() {
|
toShortString() {
|
||||||
const info = `-1 tvg-id="${this.id}" tvg-name="${this.name}" tvg-language="${this.language}" tvg-logo="${this.logo}" group-title="${this.group}",${this.title}`
|
let info = `-1 tvg-id="${this.id}" tvg-name="${this.name}" tvg-language="${this.language}" tvg-logo="${this.logo}" group-title="${this.group}",${this.title}`
|
||||||
|
|
||||||
|
if (this.referrer) {
|
||||||
|
info += `\n#EXTVLCOPT:http-referrer=${this.referrer}`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.userAgent) {
|
||||||
|
info += `\n#EXTVLCOPT:http-user-agent=${this.userAgent}`
|
||||||
|
}
|
||||||
|
|
||||||
return '#EXTINF:' + info + '\n' + this.url + '\n'
|
return '#EXTINF:' + info + '\n' + this.url + '\n'
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue