Update tataplay.com.config.js

This commit is contained in:
PopeyeTheSai10r
2025-06-11 15:21:47 -07:00
parent a333dcdae5
commit 93848b27a6

View File

@@ -24,18 +24,24 @@ module.exports = {
} }
}, },
parser({ content }) { parser(context) {
const data = JSON.parse(content) let data = []
const programs = data?.data?.epg || [] try {
const json = JSON.parse(context.content)
const programs = json?.data?.epg || []
return programs.map(program => ({ data = programs.map(program => ({
title: program.title, title: program.title,
start: program.startTime, start: program.startTime,
stop: program.endTime, stop: program.endTime,
description: program.desc, description: program.desc,
category: program.category, category: program.category,
icon: program.boxCoverImage icon: program.boxCoverImage
})) }))
} catch {
data = []
}
return data
}, },
async channels() { async channels() {
@@ -49,20 +55,17 @@ module.exports = {
'platform': 'web' 'platform': 'web'
} }
const initialResponse = await axios.get( const baseUrl = 'https://tm.tapi.videoready.tv/portal-search/pub/api/v1/channels/schedule'
'https://tm.tapi.videoready.tv/portal-search/pub/api/v1/channels/schedule?date=&languageFilters=&genreFilters=&limit=20&offset=0', const initialUrl = `${baseUrl}?date=&languageFilters=&genreFilters=&limit=20&offset=0`
{ headers } const initialResponse = await axios.get(initialUrl, { headers })
) const total = initialResponse.data?.data?.total || 0
const totalChannels = initialResponse.data?.data?.total || 0
const channels = [] const channels = []
for (let offset = 0; offset < totalChannels; offset += 20) { for (let offset = 0; offset < total; offset += 20) {
const response = await axios.get( const url = `${baseUrl}?date=&languageFilters=&genreFilters=&limit=20&offset=${offset}`
`https://tm.tapi.videoready.tv/portal-search/pub/api/v1/channels/schedule?date=&languageFilters=&genreFilters=&limit=20&offset=${offset}`, const response = await axios.get(url, { headers })
{ headers } const page = response.data?.data?.channelList || []
) channels.push(...page)
const pageChannels = response.data?.data?.channelList || []
channels.push(...pageChannels)
} }
return channels.map(channel => ({ return channels.map(channel => ({