|
|
@ -23,23 +23,29 @@ function main() {
|
|
|
|
function parseIndex() {
|
|
|
|
function parseIndex() {
|
|
|
|
const root = helper.parsePlaylist('index.m3u')
|
|
|
|
const root = helper.parsePlaylist('index.m3u')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let countries = {}
|
|
|
|
let languages = {}
|
|
|
|
let languages = {}
|
|
|
|
let categories = {}
|
|
|
|
let categories = {}
|
|
|
|
for(let rootItem of root.items) {
|
|
|
|
for(let rootItem of root.items) {
|
|
|
|
const playlist = helper.parsePlaylist(rootItem.url)
|
|
|
|
const playlist = helper.parsePlaylist(rootItem.url)
|
|
|
|
const countryCode = helper.getBasename(rootItem.url).toUpperCase()
|
|
|
|
const countryName = rootItem.name
|
|
|
|
const epg = playlist.header.attrs['x-tvg-url'] ? `<code>${playlist.header.attrs['x-tvg-url']}</code>` : ''
|
|
|
|
const countryCode = helper.getBasename(rootItem.url).toLowerCase()
|
|
|
|
|
|
|
|
const countryEpg = playlist.header.attrs['x-tvg-url'] ? `<code>${playlist.header.attrs['x-tvg-url']}</code>` : ''
|
|
|
|
// country
|
|
|
|
|
|
|
|
output.countries.push({
|
|
|
|
|
|
|
|
country: rootItem.name,
|
|
|
|
|
|
|
|
channels: playlist.items.length,
|
|
|
|
|
|
|
|
playlist: `<code>https://iptv-org.github.io/iptv/${rootItem.url}</code>`,
|
|
|
|
|
|
|
|
epg
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(let item of playlist.items) {
|
|
|
|
for(let item of playlist.items) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// country
|
|
|
|
|
|
|
|
if(countries[countryCode]) {
|
|
|
|
|
|
|
|
countries[countryCode].channels++
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
countries[countryCode] = {
|
|
|
|
|
|
|
|
country: countryName,
|
|
|
|
|
|
|
|
channels: playlist.items.length,
|
|
|
|
|
|
|
|
playlist: `<code>https://iptv-org.github.io/iptv/countries/${countryCode}.m3u</code>`,
|
|
|
|
|
|
|
|
epg: countryEpg
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// language
|
|
|
|
// language
|
|
|
|
const languageName = item.tvg.language || 'Undefined'
|
|
|
|
const languageName = item.tvg.language || 'Undefined'
|
|
|
|
const languageCode = helper.getISO6391Code(languageName) || 'undefined'
|
|
|
|
const languageCode = helper.getISO6391Code(languageName) || 'undefined'
|
|
|
@ -68,6 +74,7 @@ function parseIndex() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output.countries = Object.values(countries)
|
|
|
|
output.languages = Object.values(languages)
|
|
|
|
output.languages = Object.values(languages)
|
|
|
|
output.categories = Object.values(categories)
|
|
|
|
output.categories = Object.values(categories)
|
|
|
|
}
|
|
|
|
}
|
|
|
|