remove dupes in epg.112114.xyz

This commit is contained in:
theofficialomega
2025-08-21 13:30:32 +02:00
parent 17df63aecb
commit b299b04e11
2 changed files with 16 additions and 10 deletions

View File

@@ -20,7 +20,6 @@
<channel site="epg.112114.xyz" lang="zh" xmltv_id="" site_id="CCTV3">CCTV3</channel>
<channel site="epg.112114.xyz" lang="zh" xmltv_id="" site_id="CCTV4">CCTV4</channel>
<channel site="epg.112114.xyz" lang="zh" xmltv_id="" site_id="CCTV4K">CCTV4K</channel>
<channel site="epg.112114.xyz" lang="zh" xmltv_id="" site_id="CCTV4K">CCTV4K</channel>
<channel site="epg.112114.xyz" lang="zh" xmltv_id="" site_id="CCTV4欧洲">CCTV4欧洲</channel>
<channel site="epg.112114.xyz" lang="zh" xmltv_id="" site_id="CCTV4美洲">CCTV4美洲</channel>
<channel site="epg.112114.xyz" lang="zh" xmltv_id="" site_id="CCTV5">CCTV5</channel>
@@ -539,10 +538,8 @@
<channel site="epg.112114.xyz" lang="zh" xmltv_id="" site_id="民视新闻台">民视新闻台</channel>
<channel site="epg.112114.xyz" lang="zh" xmltv_id="" site_id="求索动物">求索动物</channel>
<channel site="epg.112114.xyz" lang="zh" xmltv_id="" site_id="求索生活">求索生活</channel>
<channel site="epg.112114.xyz" lang="zh" xmltv_id="" site_id="求索生活">求索生活</channel>
<channel site="epg.112114.xyz" lang="zh" xmltv_id="" site_id="求索科学">求索科学</channel>
<channel site="epg.112114.xyz" lang="zh" xmltv_id="" site_id="求索纪录">求索纪录</channel>
<channel site="epg.112114.xyz" lang="zh" xmltv_id="" site_id="求索纪录">求索纪录</channel>
<channel site="epg.112114.xyz" lang="zh" xmltv_id="" site_id="求索记录">求索记录</channel>
<channel site="epg.112114.xyz" lang="zh" xmltv_id="" site_id="汉语体育健康">汉语体育健康</channel>
<channel site="epg.112114.xyz" lang="zh" xmltv_id="" site_id="汉语经济生活">汉语经济生活</channel>

View File

@@ -27,14 +27,23 @@ module.exports = {
const data = await axios
.get('https://epg.112114.xyz/pp.xml')
.then(r => r.data)
.catch(console.log)
const { channels } = parser.parse(data)
.catch(e => { console.log(e); return null })
if (!data) return []
return channels.map(channel => ({
lang: 'zh',
site_id: channel.id,
name: channel.displayName[0].value
}))
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 || ''
}))
}
}