mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Create yes.co.il.config.js
This commit is contained in:
parent
40f0b0460e
commit
7445722a22
1 changed files with 57 additions and 0 deletions
57
sites/yes.co.il/yes.co.il.config.js
Normal file
57
sites/yes.co.il/yes.co.il.config.js
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
const axios = require('axios')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
site: 'yes.co.il',
|
||||||
|
days: 2,
|
||||||
|
url({ channel, date }) {
|
||||||
|
return `https://svc.yes.co.il/api/content/broadcast-schedule/channels/${
|
||||||
|
channel.site_id
|
||||||
|
}?date=${date.format('YYYY-M-D')}&ignorePastItems=true`
|
||||||
|
},
|
||||||
|
request: {
|
||||||
|
headers: {
|
||||||
|
'user-agent':
|
||||||
|
'Mozilla/5.0 (Linux; Linux x86_64) AppleWebKit/600.3 (KHTML, like Gecko) Chrome/48.0.2544.291 Safari/600'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
parser({ content }) {
|
||||||
|
const items = parseItems(content)
|
||||||
|
|
||||||
|
return items.map(item => ({
|
||||||
|
title: item.title,
|
||||||
|
description: item.description,
|
||||||
|
image: item.imageUrl,
|
||||||
|
start: item.starts,
|
||||||
|
stop: item.ends
|
||||||
|
}))
|
||||||
|
},
|
||||||
|
async channels() {
|
||||||
|
const data = await axios.get(
|
||||||
|
'https://svc.yes.co.il/api/content/broadcast-schedule/channels?page=0&pageSize=1000',
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
'accept-language': 'he-IL',
|
||||||
|
'user-agent':
|
||||||
|
'Mozilla/5.0 (Linux; Linux x86_64) AppleWebKit/600.3 (KHTML, like Gecko) Chrome/48.0.2544.291 Safari/600'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
return data.items.map(channel => ({
|
||||||
|
lang: 'he',
|
||||||
|
name: channel.title,
|
||||||
|
site_id: channel.channelId
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseItems(content) {
|
||||||
|
try {
|
||||||
|
const data = JSON.parse(content)
|
||||||
|
if (!data || !Array.isArray(data.items)) return []
|
||||||
|
|
||||||
|
return data.items
|
||||||
|
} catch {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue