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

@@ -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 || ''
}))
}
}