Fixes ID matching errors

This commit is contained in:
Aleksandr Statciuk
2022-01-13 21:57:40 +03:00
parent c6784887f5
commit 63eed52246
3 changed files with 103 additions and 107 deletions

View File

@@ -6,9 +6,7 @@ dayjs.extend(utc)
module.exports = {
site: 'dsmart.com.tr',
url({ date, channel }) {
const [page] = channel.site_id.split('#')
return `https://www.dsmart.com.tr/api/v1/public/epg/schedules?page=${page}&limit=1&day=${date.format(
return `https://www.dsmart.com.tr/api/v1/public/epg/schedules?page=1&limit=500&day=${date.format(
'YYYY-MM-DD'
)}`
},
@@ -52,9 +50,8 @@ function parseStop(item, date) {
function parseContent(content, channel) {
const data = JSON.parse(content)
if (!data || !data.data || !Array.isArray(data.data.channels)) return null
const [_, channelId] = channel.site_id.split('#')
return data.data.channels.find(i => i.ch_no == channelId)
return data.data.channels.find(i => i._id == channel.site_id)
}
function parseItems(content, channel) {