From c234766cc69c05c4bbea4d28e57bdedd845cbb27 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 8 May 2022 15:55:00 +0300 Subject: [PATCH] Update bein.com.config.js --- sites/bein.com/bein.com.config.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sites/bein.com/bein.com.config.js b/sites/bein.com/bein.com.config.js index 70619f60..aaa2949c 100644 --- a/sites/bein.com/bein.com.config.js +++ b/sites/bein.com/bein.com.config.js @@ -10,10 +10,12 @@ dayjs.extend(customParseFormat) module.exports = { site: 'bein.com', - url: function ({ date }) { + url: function ({ date, channel }) { + const [index] = channel.site_id.split('#') + return `https://www.bein.com/en/epg-ajax-template/?action=epg_fetch&category=sports&cdate=${date.format( 'YYYY-MM-DD' - )}&language=EN&loadindex=0&mins=00&offset=0&postid=25356&serviceidentity=bein.net` + )}&language=EN&loadindex=${index}&mins=00&offset=0&postid=25356&serviceidentity=bein.net` }, parser: function ({ content, channel, date }) { let programs = [] @@ -78,7 +80,8 @@ function parseStop($item, date) { } function parseItems(content, channel) { + const [_, channelId] = channel.site_id.split('#') const $ = cheerio.load(content) - return $(`#channels_${channel.site_id} .slider > ul:first-child > li`).toArray() + return $(`#channels_${channelId} .slider > ul:first-child > li`).toArray() }