mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Merge branch 'add-guida.tv'
This commit is contained in:
commit
6fa953aa13
4 changed files with 1311 additions and 0 deletions
1068
sites/guida.tv/__data__/content.html
Normal file
1068
sites/guida.tv/__data__/content.html
Normal file
File diff suppressed because it is too large
Load diff
91
sites/guida.tv/guida.tv.channels.xml
Normal file
91
sites/guida.tv/guida.tv.channels.xml
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<channels>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="20.it" site_id="77688384/mediaset-20">Mediaset 20</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="7Gold.it" site_id="55717668/7-gold">7 Gold</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="AlmaTV.it" site_id="65767765/alma">Alma</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Boing.it" site_id="66797378/boing">Boing</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Boomerang.it" site_id="79797766/sky-italian-boomerang">Sky Italian Boomerang</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="CacciaePesca.it" site_id="67656767/caccia">Caccia</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Canale5.it" site_id="676773/canale-5">Canale 5</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Cartoonito.it" site_id="67658284/cartoonito">Cartoonito</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="CartoonNetwork.it" site_id="73846765/cartoon-network-italy">Cartoon Network Italy</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Cielo.it" site_id="677679/cielo">Cielo</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Cine34.it" site_id="67735152/cine34">Cine34</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="ClassCNBC.it" site_id="67786667/class-cnbc">Class CNBC</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="ComedyCentral.it" site_id="73846767/comedy-central">Comedy Central</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="CrimePlusInvestigation.it" site_id="67827373/crimeinvestigation">Crime+Investigation</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="DeAJunior.it" site_id="68696574/dea-junior">DEA JUNIOR</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="DeAKids.it" site_id="68696575/dea-kids">DeA Kids</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="DiscoveryChannel.it" site_id="68736773/discovery-channel-i">Discovery Channel I</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="DMAX.it" site_id="68776588/dmax-italia">DMAX Italia</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="DonnaTV.it" site_id="68797878/donna-tv">Donna TV</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="EuronewsItalian.fr" site_id="83495451/euronews">Euronews</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Eurosport1.it" site_id="698573/eurosport-italia">Eurosport Italia</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Eurosport2.it" site_id="69857350/eurosport-2-italia">Eurosport 2 Italia</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Focus.it" site_id="70797384/focus">Focus</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="FoodNetwork.it" site_id="70787384/food-network">Food Network</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Frisbee.it" site_id="73708273/frisbee">Frisbee</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="GamberoRossoChannelHD.it" site_id="71657766/sky-italian-gambero-rosso-hd">Sky Italian Gambero Rosso HD</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Giallo.it" site_id="71737979/giallo">Giallo</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="HGTV.it" site_id="72717384/hgtv-it">HGTV IT</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="History.it" site_id="72738373/history">History</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="InterTV.it" site_id="73788469/inter-tv">Inter TV</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Iris.it" site_id="73827383/iris">Iris</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Italia1.it" site_id="737349/italia-1">ITALIA 1</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Italia2.it" site_id="737350/italia-2">ITALIA 2</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="K2.it" site_id="75507384/k2">K2</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="La5.it" site_id="76655373/la-5">La 5</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="LA7.it" site_id="766555/la-7">LA 7</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="LA7d.it" site_id="76655568/la7d">La7d</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="MediasetExtra.it" site_id="77686988/mediaset-extra">Mediaset Extra</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="MilanTV.it" site_id="77738486/milan-tv">Milan TV</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="MTVMusic.it" site_id="73778477/mtv-music">MTV Music</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Nickelodeon.it" site_id="73847873/nickelodeon">Nickelodeon</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="NickJr.it" site_id="73847874/nick-jr">Nick Jr.</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Nove.it" site_id="68748486/nove">Nove</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="PescaeCaccia.it" site_id="80698367/pesca">Pesca</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="RadioNorbaTV.it" site_id="82658486/radionorba-tv">Radionorba TV</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Rai1.it" site_id="826573/rai-1">RAI 1</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Rai2.it" site_id="826550/rai-2">RAI 2</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Rai3.it" site_id="826551/rai-3">RAI 3</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Rai4.it" site_id="826552/rai-4">Rai 4</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Rai5.it" site_id="826553/rai-5">Rai 5</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="RaiGulp.it" site_id="82657185/rai-gulp">Rai gulp</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="RaiMovie.it" site_id="82657377/rai-movie">RAI Movie</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="RaiNews24.it" site_id="825078/rai-24-news">RAI 24 News</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="RaiPremium.it" site_id="82657380/rai-premium">Rai Premium</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="RaiScuola.it" site_id="82696849/rai-scuola">Rai Scuola</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="RaiSportHD.it" site_id="82658350/rai-sport-hd">Rai Sport HD</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="RaiStoria.it" site_id="82738384/rai-storia">RAI STORIA</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="RaiYoyo.it" site_id="82898979/rai-yoyo">Rai YoYo</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="RealTime.it" site_id="82847384/real-time">Real Time</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Rete4.it" site_id="738252/rete-4">RETE 4</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="RTL1025TV.it" site_id="82847673/rtl-1025">RTL 102.5</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SanMarinoRTV.sm" site_id="83776578/sky-italian-san-marino-rtv">Sky Italian San Marino RTV</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkyArteHD.it" site_id="83756572/sky-arte-hdtv">Sky Arte HDTV</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkyAtlanticHD.it" site_id="83756584/sky-atlantic-hdtv">Sky Atlantic HDTV</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkyCinemaAction.it" site_id="83756765/sky-cinema-action">Sky Cinema Action</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkyCinemaCollection.it" site_id="83677976/sky-cinema-collection">Sky Cinema Collection</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkyCinemaComedy.it" site_id="83676779/sky-cinema-comedy">Sky Cinema Comedy</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkyCinemaDrama.it" site_id="83756882/sky-cinema-drama">Sky Cinema Drama</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkyCinemaDue.it" site_id="83676885/sky-cinema-due">Sky Cinema Due</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkyCinemaFamily.it" site_id="83757065/sky-cinema-family">Sky Cinema Family</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkyCinemaRomance.it" site_id="83758279/sky-cinema-romance">Sky Cinema Romance</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkyCinemaSuspense.it" site_id="83758385/sky-cinema-suspense">Sky Cinema Suspense</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkyCinemaUno.it" site_id="83756785/sky-cinema-uno">Sky Cinema Uno</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkySport24.it" site_id="83758380/sky-sport-24">SKY SPORT 24</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkySportF1.it" site_id="83837049/sky-sport-f1">Sky Sport F1</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkySportFootball.it" site_id="83757079/sky-sport-football">Sky Sport Football</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkySportMotoGP.it" site_id="83777180/sky-moto-gp">Sky Moto GP</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkySportNBA.it" site_id="83757866/sky-sport-nba">Sky Sport NBA</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkySportTennis.it" site_id="66487167/sky-sport-tennis">Sky Sport Tennis</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkySportUno.it" site_id="83838085/sky-sport-uno">Sky Sport Uno</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkyTG24.it" site_id="83495456/sky-tg24">Sky TG24</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SkyUno.it" site_id="83758578/sky-uno">Sky Uno</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Sportitalia.it" site_id="83807384/sport-italia">Sport Italia</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="Super.it" site_id="73838580/super">Super!</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="SuperTennisHD.it" site_id="83847273/super-tennis-hd">Super Tennis HD</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="TopCalcio24.it" site_id="84675052/top-calcio-24">Top Calcio 24</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="TV2000.it" site_id="73845048/tv-2000">TV 2000</channel>
|
||||||
|
<channel site="guida.tv" lang="it" xmltv_id="TV8.it" site_id="778473/tv8">TV8</channel>
|
||||||
|
</channels>
|
99
sites/guida.tv/guida.tv.config.js
Normal file
99
sites/guida.tv/guida.tv.config.js
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
const cheerio = require('cheerio')
|
||||||
|
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: 'guida.tv',
|
||||||
|
days: 2,
|
||||||
|
url: function ({ date, channel }) {
|
||||||
|
return `https://www.guida.tv/programmi-tv/palinsesto/canale/${
|
||||||
|
channel.site_id
|
||||||
|
}.html?dt=${date.format('YYYY-MM-DD')}`
|
||||||
|
},
|
||||||
|
parser: function ({ content, date, channel }) {
|
||||||
|
const programs = []
|
||||||
|
const items = parseItems(content)
|
||||||
|
items.forEach(item => {
|
||||||
|
const prev = programs[programs.length - 1]
|
||||||
|
const $item = cheerio.load(item)
|
||||||
|
let start = parseStart($item, date, channel)
|
||||||
|
if (prev) {
|
||||||
|
if (start.isBefore(prev.start)) {
|
||||||
|
start = start.add(1, 'd')
|
||||||
|
date = date.add(1, 'd')
|
||||||
|
}
|
||||||
|
prev.stop = start
|
||||||
|
}
|
||||||
|
const stop = start.add(30, 'm')
|
||||||
|
programs.push({
|
||||||
|
title: parseTitle($item),
|
||||||
|
start,
|
||||||
|
stop
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return programs
|
||||||
|
},
|
||||||
|
async channels() {
|
||||||
|
const axios = require('axios')
|
||||||
|
const _ = require('lodash')
|
||||||
|
|
||||||
|
const providers = ['-1', '-2', '-3']
|
||||||
|
|
||||||
|
const channels = []
|
||||||
|
for (let provider of providers) {
|
||||||
|
const data = await axios
|
||||||
|
.post(`https://www.guida.tv/guide/schedule`, null, {
|
||||||
|
params: {
|
||||||
|
provider,
|
||||||
|
region: 'Italy',
|
||||||
|
TVperiod: 'Night',
|
||||||
|
date: dayjs().format('YYYY-MM-DD'),
|
||||||
|
st: 0,
|
||||||
|
u_time: 1429,
|
||||||
|
is_mobile: 1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(r => r.data)
|
||||||
|
.catch(console.log)
|
||||||
|
|
||||||
|
const $ = cheerio.load(data)
|
||||||
|
$('.channelname').each((i, el) => {
|
||||||
|
const name = $(el).find('center > a:eq(1)').text()
|
||||||
|
const url = $(el).find('center > a:eq(1)').attr('href')
|
||||||
|
const [, number, slug] = url.match(/\/(\d+)\/(.*)\.html$/)
|
||||||
|
|
||||||
|
channels.push({
|
||||||
|
lang: 'it',
|
||||||
|
name,
|
||||||
|
site_id: `${number}/${slug}`
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return _.uniqBy(channels, 'site_id')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseStart($item, date, channel) {
|
||||||
|
const timeString = $item('td:eq(0)').text().trim()
|
||||||
|
const dateString = `${date.format('YYYY-MM-DD')} ${timeString}`
|
||||||
|
|
||||||
|
return dayjs.tz(dateString, 'YYYY-MM-DD HH:mm', 'Europe/Rome')
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseTitle($item) {
|
||||||
|
return $item('td:eq(1)').text().trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseItems(content) {
|
||||||
|
const $ = cheerio.load(content)
|
||||||
|
|
||||||
|
return $('table.table > tbody > tr').toArray()
|
||||||
|
}
|
53
sites/guida.tv/guida.tv.test.js
Normal file
53
sites/guida.tv/guida.tv.test.js
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
// npm run channels:parse -- --config=./sites/guida.tv/guida.tv.config.js --output=./sites/guida.tv/guida.tv.channels.xml
|
||||||
|
// npm run grab -- --site=guida.tv
|
||||||
|
|
||||||
|
const { parser, url } = require('./guida.tv.config.js')
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
|
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('2023-11-24', 'YYYY-MM-DD').startOf('d')
|
||||||
|
const channel = {
|
||||||
|
site_id: '826573/rai-1',
|
||||||
|
xmltv_id: 'Rai1.it'
|
||||||
|
}
|
||||||
|
|
||||||
|
it('can generate valid url', () => {
|
||||||
|
expect(url({ channel, date })).toBe(
|
||||||
|
'https://www.guida.tv/programmi-tv/palinsesto/canale/826573/rai-1.html?dt=2023-11-24'
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can parse response', () => {
|
||||||
|
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html'))
|
||||||
|
const results = parser({ content, channel, date }).map(p => {
|
||||||
|
p.start = p.start.toJSON()
|
||||||
|
p.stop = p.stop.toJSON()
|
||||||
|
return p
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(results[0]).toMatchObject({
|
||||||
|
start: '2023-11-24T00:10:00.000Z',
|
||||||
|
stop: '2023-11-24T01:05:00.000Z',
|
||||||
|
title: 'Viva Rai2!'
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(results[30]).toMatchObject({
|
||||||
|
start: '2023-11-24T23:00:00.000Z',
|
||||||
|
stop: '2023-11-24T23:30:00.000Z',
|
||||||
|
title: 'TV 7'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can handle empty guide', () => {
|
||||||
|
const result = parser({
|
||||||
|
date,
|
||||||
|
channel,
|
||||||
|
content: '<!DOCTYPE html><html><head></head><body></body></html>'
|
||||||
|
})
|
||||||
|
expect(result).toMatchObject([])
|
||||||
|
})
|
Loading…
Add table
Add a link
Reference in a new issue