mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-11 17:40:07 -04:00
Merge pull request #586 from iptv-org/add-mako.co.il
Add guide from mako.co.il
This commit is contained in:
commit
4475528d26
4 changed files with 118 additions and 0 deletions
17
.github/workflows/mako.co.il.yml
vendored
Normal file
17
.github/workflows/mako.co.il.yml
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
name: mako.co.il
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
workflow_run:
|
||||||
|
workflows: [_trigger]
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
jobs:
|
||||||
|
load:
|
||||||
|
uses: ./.github/workflows/_load.yml
|
||||||
|
with:
|
||||||
|
site: ${{github.workflow}}
|
||||||
|
secrets:
|
||||||
|
APP_ID: ${{ secrets.APP_ID }}
|
||||||
|
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
|
50
sites/mako.co.il/mako.co.il.config.js
Normal file
50
sites/mako.co.il/mako.co.il.config.js
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
const dayjs = require('dayjs')
|
||||||
|
const utc = require('dayjs/plugin/utc')
|
||||||
|
const timezone = require('dayjs/plugin/timezone')
|
||||||
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
|
|
||||||
|
dayjs.extend(utc)
|
||||||
|
dayjs.extend(timezone)
|
||||||
|
dayjs.extend(customParseFormat)
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
site: 'mako.co.il',
|
||||||
|
url: 'https://www.mako.co.il/AjaxPage?jspName=EPGResponse.jsp',
|
||||||
|
parser: function ({ content, date }) {
|
||||||
|
let programs = []
|
||||||
|
const items = parseItems(content, date)
|
||||||
|
items.forEach(item => {
|
||||||
|
const start = parseStart(item)
|
||||||
|
const stop = start.add(item.DurationMs, 'ms')
|
||||||
|
programs.push({
|
||||||
|
title: item.ProgramName,
|
||||||
|
description: item.EventDescription,
|
||||||
|
icon: item.Picture,
|
||||||
|
start,
|
||||||
|
stop
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return programs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseStart(item) {
|
||||||
|
if (!item.StartTimeUTC) return null
|
||||||
|
|
||||||
|
return dayjs(item.StartTimeUTC)
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseStop(item) {
|
||||||
|
if (!item.end_time) return null
|
||||||
|
|
||||||
|
return dayjs.tz(item.end_time, 'YYYY-MM-DDTHH:mm:ss', 'Asia/Jerusalem')
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseItems(content, date) {
|
||||||
|
const data = JSON.parse(content)
|
||||||
|
if (!data || !Array.isArray(data.programs)) return []
|
||||||
|
const d = date.format('DD/MM/YYYY')
|
||||||
|
|
||||||
|
return data.programs.filter(item => item.Date.startsWith(d))
|
||||||
|
}
|
45
sites/mako.co.il/mako.co.il.test.js
Normal file
45
sites/mako.co.il/mako.co.il.test.js
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
// npx epg-grabber --config=sites/mako.co.il/mako.co.il.config.js --channels=sites/mako.co.il/mako.co.il_il.channels.xml --output=guide.xml --days=2
|
||||||
|
|
||||||
|
const { parser, url } = require('./mako.co.il.config.js')
|
||||||
|
const dayjs = require('dayjs')
|
||||||
|
const utc = require('dayjs/plugin/utc')
|
||||||
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
|
dayjs.extend(customParseFormat)
|
||||||
|
dayjs.extend(utc)
|
||||||
|
|
||||||
|
const date = dayjs.utc('2022-03-07', 'YYYY-MM-DD').startOf('d')
|
||||||
|
const channel = {
|
||||||
|
site_id: '#',
|
||||||
|
xmltv_id: 'Keshet12.il'
|
||||||
|
}
|
||||||
|
|
||||||
|
it('can generate valid url', () => {
|
||||||
|
expect(url).toBe('https://www.mako.co.il/AjaxPage?jspName=EPGResponse.jsp')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can parse response', () => {
|
||||||
|
const content = `{"programs":[{"DisplayEndTime":"06:15","MakoTVURL":"","HouseNumber":"L17165475","StartTimeUTC":1646539200000,"DurationMs":900000,"DisplayStartTime":"06:00","MobilePicture":"https://img.mako.co.il/2017/01/01/placeHolder.jpg","StartTime":"06/03/2022 06:00:00","RerunBroadcast":false,"Duration":"00:15","ProgramName":"כותרות הבוקר","Date":"06/03/2022 06:00:00","MakoProgramsURL":"","LiveBroadcast":true,"ProgramCode":134987,"Episode":"","Picture":"https://img.mako.co.il//2021/08/04/hadshot_haboker_im_niv_raskin.jpg","MakoShortName":"","hebrewDate":"6 במרץ","Season":"","day":"הערב","EventDescription":"","EnglishName":"cotrot,EP 46"},{"DisplayEndTime":"02:39","MakoTVURL":"","HouseNumber":"A168960","StartTimeUTC":1646613480000,"DurationMs":60000,"DisplayStartTime":"02:38","MobilePicture":"https://img.mako.co.il/2017/01/01/placeHolder.jpg","StartTime":"07/03/2022 02:38:00","RerunBroadcast":true,"Duration":"00:01","ProgramName":"רוקדים עם כוכבים - בר זומר","Date":"07/03/2022 02:38:00","MakoProgramsURL":"","LiveBroadcast":false,"ProgramCode":135029,"Episode":"","Picture":"https://img.mako.co.il/2022/02/13/DancingWithStars2022_EPG.jpg","MakoShortName":"","hebrewDate":"7 במרץ","Season":"","day":"מחר","EventDescription":"מהדורת החדשות המרכזית של הבוקר, האנשים הפרשנויות והכותרות שיעשו את היום.","EnglishName":"rokdim,EP 10"}]}`
|
||||||
|
const result = parser({ content, date }).map(p => {
|
||||||
|
p.start = p.start.toJSON()
|
||||||
|
p.stop = p.stop.toJSON()
|
||||||
|
return p
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(result).toMatchObject([
|
||||||
|
{
|
||||||
|
start: '2022-03-07T00:38:00.000Z',
|
||||||
|
stop: '2022-03-07T00:39:00.000Z',
|
||||||
|
title: 'רוקדים עם כוכבים - בר זומר',
|
||||||
|
description: 'מהדורת החדשות המרכזית של הבוקר, האנשים הפרשנויות והכותרות שיעשו את היום.',
|
||||||
|
icon: 'https://img.mako.co.il/2022/02/13/DancingWithStars2022_EPG.jpg'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can handle empty guide', () => {
|
||||||
|
const result = parser({
|
||||||
|
content: `[]`,
|
||||||
|
date
|
||||||
|
})
|
||||||
|
expect(result).toMatchObject([])
|
||||||
|
})
|
6
sites/mako.co.il/mako.co.il_il.channels.xml
Normal file
6
sites/mako.co.il/mako.co.il_il.channels.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<site site="mako.co.il">
|
||||||
|
<channels>
|
||||||
|
<channel lang="he" xmltv_id="Keshet12.il" site_id="#">Keshet 12</channel>
|
||||||
|
</channels>
|
||||||
|
</site>
|
Loading…
Add table
Add a link
Reference in a new issue