mirror of
https://github.com/iptv-org/epg
synced 2025-12-16 10:26:41 -05:00
Expose more channel ids by looping through countryCodes
This commit is contained in:
@@ -34,11 +34,13 @@ module.exports = {
|
||||
async channels({ lang = 'en' }) {
|
||||
const axios = require('axios')
|
||||
const items = []
|
||||
const countryCodes = ['EG', 'SA', 'US']
|
||||
for (let country of countryCodes) {
|
||||
let page = 0
|
||||
while (true) {
|
||||
const result = await axios
|
||||
.get(
|
||||
`https://api2.shahid.net/proxy/v2.1/product/filter?filter=%7B"pageNumber":${page},"pageSize":100,"productType":"LIVESTREAM","productSubType":"LIVE_CHANNEL"%7D&country=SA&language=${lang}&Accept-Language=${lang}`
|
||||
`https://api2.shahid.net/proxy/v2.1/product/filter?filter=%7B"pageNumber":${page},"pageSize":100,"productType":"LIVESTREAM","productSubType":"LIVE_CHANNEL"%7D&country=${country}&language=${lang}&Accept-Language=${lang}`
|
||||
)
|
||||
.then(response => response.data)
|
||||
.catch(console.error)
|
||||
@@ -51,7 +53,9 @@ module.exports = {
|
||||
}
|
||||
break
|
||||
}
|
||||
const channels = items.map(channel => {
|
||||
}
|
||||
const uniqueItems = Array.from(new Map(items.map(item => [item.id, item])).values())
|
||||
const channels = uniqueItems.map(channel => {
|
||||
return {
|
||||
lang,
|
||||
site_id: channel.id,
|
||||
|
||||
Reference in New Issue
Block a user