mirror of
https://github.com/iptv-org/epg
synced 2025-12-16 10:26:41 -05:00
Merge pull request #2886 from huncrys/fix/musor.tv-selectors
Fix parsing for musor.tv
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -19,11 +19,13 @@
|
||||
<channel site="musor.tv" lang="en" xmltv_id="TraceUrban.fr" site_id="TRACEURBAN">Trace Urban (HD)</channel>
|
||||
<channel site="musor.tv" lang="en" xmltv_id="Travelxp.in" site_id="TRAVELXP">Travel XP (HD)</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="360TUNEBOX">360 TuneBox</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="ATV_EXTRA">ATV Extra (HD)</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="AXN">AXN (HD)</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="CARTOONITO">Cartoonito</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="CSUKAS_RADIO">Csukás Meserádió</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="DANKO_RADIO">Dankó Rádió</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="DEBRECEN_TV">Debrecen TV</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="DUCKHD">Duck TV HD</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="DUNAWORLDRADIO">Duna World Rádió</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="ELSO_KERULET_TV">Első Kerület TV HD</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="FASHIONTV">Fashion TV</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="FILMBOX">Filmbox (HD)</channel>
|
||||
@@ -41,6 +43,7 @@
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="MR4">Nemzetiségi Adások</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="MR_SPORT_RADIO">Nemzeti Sport Rádió</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="MTVHU">MTV Hungary</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="NESHAMA_TV">Neshama TV</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="NICKELODEONHD">Nickelodeon HD</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="PESTBUDA_TV">PestBuda TV HD</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="RTL3">RTL HÁROM (HD)</channel>
|
||||
@@ -59,9 +62,7 @@
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="ApostolTV.hu" site_id="APOSTOL_TV">Apostol TV</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="Arena4.hu" site_id="ARENA4">Arena4 (HD)</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="ATV.hu" site_id="ATV">ATV (HD)</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="ATVSpirit.hu" site_id="ATV_SPIRIT">ATV Spirit (HD)</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="automotorundsportchannel.de" site_id="AUTO_MOTOR_SPORT">Auto Motor Sport (HD)</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="" site_id="AXN">AXN (HD)</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="BabyTV.uk" site_id="BABYTV">Baby TV</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="BalatonTV.hu" site_id="BALATON_TV">Balaton TV</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="BBCEarth.uk@Romania" site_id="BBC_EARTH">BBC Earth (HD)</channel>
|
||||
@@ -105,7 +106,6 @@
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="FunBoxUHD.nl" site_id="FUNBOX_UHD">Funbox UltraHD 4K</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="Galaxy4.hu" site_id="GALAXY">Galaxy 4 (HD)</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="Gametoon.nl" site_id="GAMETOON">Gametoon (HD)</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="Hatoscsatorna.hu" site_id="HATOS_CSATORNA">Hatoscsatorna</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="HBO2CentralEurope.hu@HD" site_id="HBO2">HBO 2 (HD)</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="HBO3CentralEurope.hu@HD" site_id="HBO3">HBO 3 (HD)</channel>
|
||||
<channel site="musor.tv" lang="hu" xmltv_id="HegyvidekTV.hu" site_id="HEGYVIDEK_TV">Hegyvidék TV</channel>
|
||||
|
||||
@@ -3,6 +3,7 @@ const axios = require('axios')
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||
const uniqBy = require('lodash.uniqby')
|
||||
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(customParseFormat)
|
||||
@@ -49,38 +50,42 @@ module.exports = {
|
||||
|
||||
const $ = cheerio.load(html)
|
||||
const channels = $('body > div.big_content > div > nav > table > tbody > tr > td > a').toArray()
|
||||
return channels
|
||||
.map(item => {
|
||||
const $item = $(item)
|
||||
const url = $item.attr('href')
|
||||
if (!url.startsWith('//musor.tv/mai/tvmusor/')) return null
|
||||
const site_id = url.replace('//musor.tv/mai/tvmusor/', '')
|
||||
return {
|
||||
lang: 'hu',
|
||||
site_id,
|
||||
name: $item.text()
|
||||
}
|
||||
})
|
||||
.filter(i => i)
|
||||
|
||||
return uniqBy(
|
||||
channels
|
||||
.map(item => {
|
||||
const $item = $(item)
|
||||
const url = $item.attr('href')
|
||||
if (!url.startsWith('//musor.tv/mai/tvmusor/')) return null
|
||||
const site_id = url.replace('//musor.tv/mai/tvmusor/', '')
|
||||
return {
|
||||
lang: 'hu',
|
||||
site_id,
|
||||
name: $item.text()
|
||||
}
|
||||
})
|
||||
.filter(i => i),
|
||||
'site_id'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function parseImage($item) {
|
||||
const imgSrc = $item.find('div.smartpe_screenshot > img').attr('src')
|
||||
const imgSrc = $item.find('div.progentry_screenshot > img').attr('src')
|
||||
|
||||
return imgSrc ? `https:${imgSrc}` : null
|
||||
}
|
||||
|
||||
function parseTitle($item) {
|
||||
return $item.find('div:nth-child(2) > div > h3 > a').text().trim()
|
||||
return $item.find('h3 > a').text().trim()
|
||||
}
|
||||
|
||||
function parseDescription($item) {
|
||||
return $item.find('div:nth-child(5) > div > div').text().trim()
|
||||
return $item.find('div.progentrylong').text().trim()
|
||||
}
|
||||
|
||||
function parseStart($item) {
|
||||
let datetime = $item.find('div:nth-child(1) > div > div > div > div > time').attr('content')
|
||||
let datetime = $item.find('time').attr('content')
|
||||
if (!datetime) return null
|
||||
|
||||
return dayjs.utc(datetime.replace('GMT', 'T'), 'YYYY-MM-DDTHH:mm:ss')
|
||||
@@ -89,5 +94,5 @@ function parseStart($item) {
|
||||
function parseItems(content) {
|
||||
const $ = cheerio.load(content)
|
||||
|
||||
return [$, $('div.multicolumndayprogarea > div.smartpe_progentry').toArray()]
|
||||
return [$, $('div.progarea > div.progentry > div.progentry_internal').toArray()]
|
||||
}
|
||||
|
||||
@@ -8,20 +8,20 @@ const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||
dayjs.extend(customParseFormat)
|
||||
dayjs.extend(utc)
|
||||
|
||||
const date = dayjs.utc('2022-11-19', 'YYYY-MM-DD').startOf('d')
|
||||
const date = dayjs.utc('2025-10-11', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = {
|
||||
site_id: 'HATOS_CSATORNA',
|
||||
xmltv_id: 'Hatoscsatorna.hu'
|
||||
site_id: 'MAGYAR_MOZI_TV',
|
||||
xmltv_id: 'MagyarMoziTV.hu',
|
||||
}
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url({ channel, date })).toBe('https://musor.tv/napi/tvmusor/HATOS_CSATORNA/2022.11.19')
|
||||
expect(url({ channel, date })).toBe('https://musor.tv/napi/tvmusor/MAGYAR_MOZI_TV/2025.10.11')
|
||||
})
|
||||
|
||||
it('can generate valid url for today', () => {
|
||||
const today = dayjs.utc().startOf('d')
|
||||
|
||||
expect(url({ channel, date: today })).toBe('https://musor.tv/mai/tvmusor/HATOS_CSATORNA')
|
||||
expect(url({ channel, date: today })).toBe('https://musor.tv/mai/tvmusor/MAGYAR_MOZI_TV')
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
@@ -33,18 +33,17 @@ it('can parse response', () => {
|
||||
})
|
||||
|
||||
expect(results[0]).toMatchObject({
|
||||
start: '2022-11-19T23:00:00.000Z',
|
||||
stop: '2022-11-19T23:30:00.000Z',
|
||||
title: 'Egészségtér',
|
||||
description:
|
||||
'Egészségtér címmel új természetgyógyászattal foglalkozó magazinműsor indult hetente fél órás időtartamban a hatoscsatornán. A műsor derűs, objektív hangvételével és szakmailag magas színvonalú ismeretterjesztő jellegével az e'
|
||||
start: '2025-10-10T23:05:00.000Z',
|
||||
stop: '2025-10-11T00:50:00.000Z',
|
||||
title: 'A 25. év - Három rohadék rockcsempész (Tankcsapda road movie)',
|
||||
description: 'Lévai Balázs több mint egy éven át forgatott a Tankcsapdával.'
|
||||
})
|
||||
|
||||
expect(results[1]).toMatchObject({
|
||||
start: '2022-11-19T23:30:00.000Z',
|
||||
stop: '2022-11-20T00:00:00.000Z',
|
||||
title: 'Tradíció Klipek',
|
||||
description: 'Tradíció Klipek Birinyi József néprajzi, vallási, népzenei, népszokás filmjeiből.'
|
||||
start: '2025-10-11T00:50:00.000Z',
|
||||
stop: '2025-10-11T01:45:00.000Z',
|
||||
title: 'Megbélyegzetten - 1968',
|
||||
description: 'Néhány tinédzser diák, egy csalinak szánt újságcikk nyomán levelet írt Ausztriába 1968-ban.'
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user