mirror of
https://github.com/iptv-org/epg
synced 2026-05-07 18:07:05 -04:00
LF to CRLF
This commit is contained in:
@@ -1,54 +1,57 @@
|
||||
const axios = require('axios')
|
||||
const parser = require('epg-parser')
|
||||
|
||||
module.exports = {
|
||||
site: 'epg.112114.xyz',
|
||||
days: 1,
|
||||
url: 'https://epg.112114.xyz/pp.xml',
|
||||
request: {
|
||||
cache: {
|
||||
ttl: 24 * 60 * 60 * 1000 // 1 day
|
||||
}
|
||||
},
|
||||
parser: function ({ content, channel, date }) {
|
||||
let programs = []
|
||||
const items = parseItems(content, channel, date)
|
||||
items.forEach(item => {
|
||||
programs.push({
|
||||
title: item.title?.[0]?.value,
|
||||
start: item.start,
|
||||
stop: item.stop
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels() {
|
||||
const data = await axios
|
||||
.get('https://epg.112114.xyz/pp.xml')
|
||||
.then(r => r.data)
|
||||
.catch(e => { console.log(e); return null })
|
||||
if (!data) return []
|
||||
|
||||
const { channels = [] } = parser.parse(data)
|
||||
|
||||
const seen = new Set()
|
||||
return channels
|
||||
.filter(ch => {
|
||||
if (seen.has(ch.id)) return false
|
||||
seen.add(ch.id)
|
||||
return true
|
||||
})
|
||||
.map(channel => ({
|
||||
lang: 'zh',
|
||||
site_id: channel.id,
|
||||
name: channel.displayName?.[0]?.value || ''
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
function parseItems(content, channel, date) {
|
||||
const { programs } = parser.parse(content)
|
||||
|
||||
return programs.filter(p => p.channel === channel.site_id && date.isSame(p.start, 'day'))
|
||||
}
|
||||
const axios = require('axios')
|
||||
const parser = require('epg-parser')
|
||||
|
||||
module.exports = {
|
||||
site: 'epg.112114.xyz',
|
||||
days: 1,
|
||||
url: 'https://epg.112114.xyz/pp.xml',
|
||||
request: {
|
||||
cache: {
|
||||
ttl: 24 * 60 * 60 * 1000 // 1 day
|
||||
}
|
||||
},
|
||||
parser: function ({ content, channel, date }) {
|
||||
let programs = []
|
||||
const items = parseItems(content, channel, date)
|
||||
items.forEach(item => {
|
||||
programs.push({
|
||||
title: item.title?.[0]?.value,
|
||||
start: item.start,
|
||||
stop: item.stop
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels() {
|
||||
const data = await axios
|
||||
.get('https://epg.112114.xyz/pp.xml')
|
||||
.then(r => r.data)
|
||||
.catch(e => {
|
||||
console.log(e)
|
||||
return null
|
||||
})
|
||||
if (!data) return []
|
||||
|
||||
const { channels = [] } = parser.parse(data)
|
||||
|
||||
const seen = new Set()
|
||||
return channels
|
||||
.filter(ch => {
|
||||
if (seen.has(ch.id)) return false
|
||||
seen.add(ch.id)
|
||||
return true
|
||||
})
|
||||
.map(channel => ({
|
||||
lang: 'zh',
|
||||
site_id: channel.id,
|
||||
name: channel.displayName?.[0]?.value || ''
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
function parseItems(content, channel, date) {
|
||||
const { programs } = parser.parse(content)
|
||||
|
||||
return programs.filter(p => p.channel === channel.site_id && date.isSame(p.start, 'day'))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user