improve firstmedia

This commit is contained in:
ta 2023-06-15 17:05:09 +07:00
parent 66360221ff
commit 751fb1e7a5
2 changed files with 8 additions and 6 deletions

View file

@ -1,13 +1,15 @@
const dayjs = require("dayjs");
const timezone = require("dayjs/plugin/timezone");
const utc = require('dayjs/plugin/utc');
dayjs.extend(timezone);
dayjs.extend(utc);
module.exports = {
site: "firstmedia.com",
days: 2,
days: 1,
url: function ({ channel, date }) {
return `https://www.firstmedia.com/ajax/schedule?date=${
date.format("DD/MM/YYYY")
return `https://www.firstmedia.com/ajax/schedule?date=${date.format("DD/MM/YYYY")
}&channel=${channel.site_id}&start_time=1&end_time=24&need_channels=0`;
},
parser: function ({ content, channel }) {
@ -29,7 +31,7 @@ module.exports = {
};
function parseItems(content, channel) {
return JSON.parse(content).entries[channel];
return JSON.parse(content.trim()).entries[channel];
}
function parseTitle(item) {