mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Merge pull request #253 from iptv-org/update-maxtv-hrvatskitelekom-hr
Update maxtv.hrvatskitelekom.hr
This commit is contained in:
commit
9342a4e58c
4 changed files with 97 additions and 25 deletions
|
@ -1,9 +1,12 @@
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
|
const utc = require('dayjs/plugin/utc')
|
||||||
|
|
||||||
|
dayjs.extend(utc)
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'canalplus-reunion.com',
|
site: 'canalplus-reunion.com',
|
||||||
url: function ({ channel, date }) {
|
url: function ({ channel, date }) {
|
||||||
const diff = date.diff(dayjs().startOf('d'), 'd')
|
const diff = date.diff(dayjs.utc().startOf('d'), 'd')
|
||||||
|
|
||||||
return `https://service.canal-overseas.com/ott-frontend/vector/63001/channel/${channel.site_id}/events?filter.day=${diff}`
|
return `https://service.canal-overseas.com/ott-frontend/vector/63001/channel/${channel.site_id}/events?filter.day=${diff}`
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,37 +7,43 @@ module.exports = {
|
||||||
data: function ({ channel, date }) {
|
data: function ({ channel, date }) {
|
||||||
return {
|
return {
|
||||||
channelList: [channel.site_id],
|
channelList: [channel.site_id],
|
||||||
startDate: date.startOf('d').unix(),
|
startDate: date.unix(),
|
||||||
endDate: date.endOf('d').unix()
|
endDate: date.add(1, 'd').unix()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
url: function ({ date, channel }) {
|
url: 'https://player.maxtvtogo.tportal.hr:8082/OTT4Proxy/proxy/epg/shows',
|
||||||
return `https://player.maxtvtogo.tportal.hr:8082/OTT4Proxy/proxy/epg/shows`
|
logo: function ({ content, channel }) {
|
||||||
},
|
const data = parseContent(content, channel)
|
||||||
logo: function ({ content }) {
|
|
||||||
const json = JSON.parse(content)
|
|
||||||
return json.data ? json.data[0].logo : null
|
|
||||||
},
|
|
||||||
parser: function ({ content }) {
|
|
||||||
const programs = []
|
|
||||||
const json = JSON.parse(content)
|
|
||||||
if (!json.data) return programs
|
|
||||||
|
|
||||||
const items = json.data[0].shows
|
return data ? data.logo : null
|
||||||
|
},
|
||||||
|
parser: function ({ content, channel }) {
|
||||||
|
const programs = []
|
||||||
|
const items = parseItems(content, channel)
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
if (item.title && item.startTime && item.endTime) {
|
if (item.showId == -1) return
|
||||||
const start = dayjs.unix(item.startTime)
|
|
||||||
const stop = dayjs.unix(item.endTime)
|
|
||||||
programs.push({
|
programs.push({
|
||||||
title: item.title,
|
title: item.title,
|
||||||
category: item.category,
|
category: item.category,
|
||||||
start: start.toString(),
|
start: dayjs.unix(item.startTime),
|
||||||
stop: stop.toString()
|
stop: dayjs.unix(item.endTime)
|
||||||
})
|
})
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return programs
|
return programs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseContent(content, channel) {
|
||||||
|
const json = JSON.parse(content)
|
||||||
|
if (!Array.isArray(json.data)) return null
|
||||||
|
|
||||||
|
return json.data.find(i => i.channelId == channel.site_id)
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseItems(content, channel) {
|
||||||
|
const data = parseContent(content, channel)
|
||||||
|
|
||||||
|
return data && Array.isArray(data.shows) ? data.shows : []
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
// npx epg-grabber --config=sites/maxtv.hrvatskitelekom.hr/maxtv.hrvatskitelekom.hr.config.js --channels=sites/maxtv.hrvatskitelekom.hr/maxtv.hrvatskitelekom.hr_hr.channels.xml --output=.gh-pages/guides/hr/maxtv.hrvatskitelekom.hr.epg.xml --days=2
|
||||||
|
|
||||||
|
const { parser, url, request, logo } = require('./maxtv.hrvatskitelekom.hr.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('2021-11-16', 'YYYY-MM-DD').startOf('d')
|
||||||
|
const channel = {
|
||||||
|
site_id: '316',
|
||||||
|
xmltv_id: '24KitchenHrvatska.us'
|
||||||
|
}
|
||||||
|
const content = `{"status":{"code":200,"message":"OK","authType":"Unauthenticated","ottSessionToken":null},"data":[{"channelId":"316","title":"24Kitchen","logo":"http://ottepg5.nexttv.ht.hr:33200/EPG/jsp/images/universal/film/logo/fileEntity/20161109/000200/XTV100002173/493d03f8-0f08-4932-8371-e5b57d96f17d.png","chanNumber":500,"hasCatchup":false,"ottChannel":true,"userSubscribed":false,"shows":[{"showId":"-1","title":"Nema informacija","startTime":1636952400,"endTime":1636967400,"category":"ostalo","hasReminder":false,"hasRecording":false,"hasSeriesRecording":false,"userOttPlayable":false,"userLocked":false,"isPPV":false,"buyPrice":""},{"showId":"17298142","title":"Najčudniji svjetski restorani","startTime":1636952400,"endTime":1636952700,"category":"Kulinarski","hasReminder":false,"hasRecording":false,"hasSeriesRecording":false,"userOttPlayable":false,"userLocked":false,"isPPV":false,"buyPrice":""}]}]}`
|
||||||
|
|
||||||
|
it('can generate valid url', () => {
|
||||||
|
expect(url).toBe('https://player.maxtvtogo.tportal.hr:8082/OTT4Proxy/proxy/epg/shows')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can generate valid request data', () => {
|
||||||
|
expect(request.data({ channel, date })).toMatchObject({
|
||||||
|
channelList: ['316'],
|
||||||
|
startDate: 1637020800,
|
||||||
|
endDate: 1637107200
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can get logo url', () => {
|
||||||
|
expect(logo({ channel, content })).toBe(
|
||||||
|
'http://ottepg5.nexttv.ht.hr:33200/EPG/jsp/images/universal/film/logo/fileEntity/20161109/000200/XTV100002173/493d03f8-0f08-4932-8371-e5b57d96f17d.png'
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can parse response', () => {
|
||||||
|
const result = parser({ channel, content }).map(p => {
|
||||||
|
p.start = p.start.toJSON()
|
||||||
|
p.stop = p.stop.toJSON()
|
||||||
|
return p
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(result).toMatchObject([
|
||||||
|
{
|
||||||
|
start: '2021-11-15T05:00:00.000Z',
|
||||||
|
stop: '2021-11-15T05:05:00.000Z',
|
||||||
|
title: 'Najčudniji svjetski restorani',
|
||||||
|
category: 'Kulinarski'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can handle empty guide', () => {
|
||||||
|
const result = parser({
|
||||||
|
date,
|
||||||
|
channel,
|
||||||
|
content: `{"status":{"code":200,"message":"OK","authType":"Unauthenticated","ottSessionToken":null},"data":[]}`
|
||||||
|
})
|
||||||
|
expect(result).toMatchObject([])
|
||||||
|
})
|
|
@ -121,6 +121,7 @@
|
||||||
<channel lang="hr" xmltv_id="Rai3.it" site_id="257">Rai 3</channel>
|
<channel lang="hr" xmltv_id="Rai3.it" site_id="257">Rai 3</channel>
|
||||||
<channel lang="hr" xmltv_id="RaiScuola.it" site_id="325">Rai Scuola</channel>
|
<channel lang="hr" xmltv_id="RaiScuola.it" site_id="325">Rai Scuola</channel>
|
||||||
<channel lang="hr" xmltv_id="RTL2Hrvatska.de" site_id="455">RTL 2 Hrvatska</channel>
|
<channel lang="hr" xmltv_id="RTL2Hrvatska.de" site_id="455">RTL 2 Hrvatska</channel>
|
||||||
|
<channel lang="hr" xmltv_id="RTLAdriaHrvatska.de" site_id="736">RTL Adria Hrvatska</channel>
|
||||||
<channel lang="hr" xmltv_id="RTLCrimeHrvatska.de" site_id="342">RTL Crime Hrvatska</channel>
|
<channel lang="hr" xmltv_id="RTLCrimeHrvatska.de" site_id="342">RTL Crime Hrvatska</channel>
|
||||||
<channel lang="hr" xmltv_id="RTLDeutschland.de" site_id="319">RTL Deutschland</channel>
|
<channel lang="hr" xmltv_id="RTLDeutschland.de" site_id="319">RTL Deutschland</channel>
|
||||||
<channel lang="hr" xmltv_id="RTLHrvatska.de" site_id="454">RTL Hrvatska</channel>
|
<channel lang="hr" xmltv_id="RTLHrvatska.de" site_id="454">RTL Hrvatska</channel>
|
||||||
|
@ -139,6 +140,9 @@
|
||||||
<channel lang="hr" xmltv_id="SportKlub1Hrvatska.hu" site_id="447">Sport Klub 1 Hrvatska</channel>
|
<channel lang="hr" xmltv_id="SportKlub1Hrvatska.hu" site_id="447">Sport Klub 1 Hrvatska</channel>
|
||||||
<channel lang="hr" xmltv_id="SportKlub2Srbija.hu" site_id="448">Sport Klub 2 Srbija</channel>
|
<channel lang="hr" xmltv_id="SportKlub2Srbija.hu" site_id="448">Sport Klub 2 Srbija</channel>
|
||||||
<channel lang="hr" xmltv_id="SportKlub3.hu" site_id="221">Sport Klub 3</channel>
|
<channel lang="hr" xmltv_id="SportKlub3.hu" site_id="221">Sport Klub 3</channel>
|
||||||
|
<channel lang="hr" xmltv_id="SportKlub4.hu" site_id="222">Sport Klub 4</channel>
|
||||||
|
<channel lang="hr" xmltv_id="SportKlub5.hu" site_id="223">Sport Klub 5</channel>
|
||||||
|
<channel lang="hr" xmltv_id="SportKlub6.hu" site_id="224">Sport Klub 6</channel>
|
||||||
<channel lang="hr" xmltv_id="SportKlubEsports.hu" site_id="751">Sport Klub Esports</channel>
|
<channel lang="hr" xmltv_id="SportKlubEsports.hu" site_id="751">Sport Klub Esports</channel>
|
||||||
<channel lang="hr" xmltv_id="SportKlubGolf.hu" site_id="313">Sport Klub Golf</channel>
|
<channel lang="hr" xmltv_id="SportKlubGolf.hu" site_id="313">Sport Klub Golf</channel>
|
||||||
<channel lang="hr" xmltv_id="SportKlubStart.hu" site_id="308">Sport Klub Start</channel>
|
<channel lang="hr" xmltv_id="SportKlubStart.hu" site_id="308">Sport Klub Start</channel>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue