+
+
+
+
+
+
+
+
+ Ooops... Errore 404
+
+
+ Ci dispiace, ma la pagina che stai cercando non esiste.
+
+
+
+
+
I NOSTRI ULTIMI POST
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sites/superguidatv.it/superguidatv.it.channels.xml b/sites/superguidatv.it/superguidatv.it.channels.xml
new file mode 100644
index 00000000..fc58eba3
--- /dev/null
+++ b/sites/superguidatv.it/superguidatv.it.channels.xml
@@ -0,0 +1,183 @@
+
+
+
+ Fox News
+ France 24 English
+ I24news
+ France 24
+ 20
+ Twenty Seven
+ Italia 7 Gold
+ ACI Sport Tv
+ Alma TV
+ Baby TV
+ Blaze
+ Bloomberg
+ Boing
+ Boing Plus
+ Boomerang
+ Boomerang + 1
+ CNBC
+ CNN Intl
+ Caccia e Pesca
+ Canale 5
+ Cartoon Network
+ CN +1
+ Cartoonito
+ Cielo
+ Cine34
+ Class-Cnbc
+ Classica HD
+ Comedy Central
+ Crime+ Inv.
+ DMAX
+ DeA Junior
+ DeAKids
+ DeAKids+1
+ Deejay TV
+ Discovery Channel HD
+ Discovery Ch +1
+ Discovery Science HD
+ DonnaTv
+ Euronews
+ Eurosport HD
+ Eurosport 2HD
+ Focus
+ FoodNetwork
+ Fox Business
+ Fox HD
+ Fox +1
+ Frisbee
+ GM24
+ Gambero Rosso HD
+ Giallo
+ HGTV - Home&Garden
+ History HD
+ History 1
+ Horse TV HD
+ Inter TV HD
+ Iris
+ Italia 1
+ Italia 2
+ K2
+ La 5
+ La7
+ La7d
+ Lazio Style Channel
+ MTV
+ Mtv Music
+ Mediaset Extra
+ Milan TV
+ Motor Trend HD
+ National Geo HD
+ NationalGeo +1
+ National Geographic Wild
+ Nat Geo Wild +1
+ Nick Junior
+ Nick Jr+1
+ Nickelodeon
+ Nickelodeon + 1
+ Nove
+ Pesca e Caccia
+ Premium Action
+ Premium Cinema 1
+ Premium Cinema 2
+ Premium Cinema 3
+ Premium Crime
+ Premium Stories
+ QVC
+ R101
+ La 1
+ La 2
+ RTL 102.5 TV
+ Radio 105
+ Radio Freccia
+ Radio Italia Tv
+ Radio Monte Carlo
+ Radionorba TV
+ Rai 1
+ Rai 2
+ Rai 3
+ Rai 4
+ Rai 5
+ Rai Gulp
+ Rai Movie
+ RaiNews24
+ Rai Premium
+ Rai Scuola
+ RaiSport
+ Rai Sport + HD
+ Rai Storia
+ Rai Yoyo
+ Real Time
+ Rete 4
+ Sky Arte HD
+ Sky Atlantic HD
+ Sky Atlantic +1
+ Sky Cinema Action HD
+ Sky Cinema Collection HD
+ Sky Cinema Comedy HD
+ Sky Cinema Drama HD
+ Sky Cinema Due HD
+ Sky Cinema Due +24
+ Sky Cinema Family HD
+ Sky Cinema Romance HD
+ Sky Cinema Suspense HD
+ Sky Cinema Uno HD
+ Sky Cinema Uno +24
+ Sky Documentaries HD
+ Sky Documentaries +1 HD
+ Sky Investigation HD
+ Sky Investigation +1 HD
+ Sky Meteo24
+ Sky Nature HD
+ Primafila 1
+ Primafila 2
+ Primafila 3
+ Primafila 4
+ Primafila 5
+ Sky Serie HD
+ Sky Sport24
+ Sky Sport Action HD
+ Sky Sport Arena
+ Sky Sport Calcio
+ Sky Sport F1 HD
+ Sky Sport Football HD
+ Sky Sport MotoGP
+ Sky Sport NBA
+ Sky Sport Tennis HD
+ Sky Sport Uno
+ Sky Tg24
+ Sky Uno HD
+ Sky Uno +1HD
+ Sportitalia
+ Super!
+ SuperTennis
+ Tgcom24
+ TG Norba24
+ TRM h24
+ TV2000
+ TV8
+ Top Calcio 24
+ Top Crime
+ VH1
+ Virgin Radio
+ Warner TV
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sites/superguidatv.it/superguidatv.it.config.js b/sites/superguidatv.it/superguidatv.it.config.js
new file mode 100644
index 00000000..d71e8589
--- /dev/null
+++ b/sites/superguidatv.it/superguidatv.it.config.js
@@ -0,0 +1,122 @@
+const cheerio = require('cheerio')
+const axios = require('axios')
+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: 'superguidatv.it',
+ days: 3,
+ url({ channel, date }) {
+ let diff = date.diff(dayjs.utc().startOf('d'), 'd')
+ let day = {
+ 0: 'oggi',
+ 1: 'domani',
+ 2: 'dopodomani'
+ }
+
+ return `https://www.superguidatv.it/programmazione-canale/${day[diff]}/guida-programmi-tv-${channel.site_id}/`
+ },
+ parser({ content, date }) {
+ const programs = []
+ const items = parseItems(content)
+ items.forEach(item => {
+ const $item = cheerio.load(item)
+ const prev = programs[programs.length - 1]
+ let start = parseStart($item, date)
+ 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),
+ category: parseCategory($item),
+ start,
+ stop
+ })
+ })
+
+ return programs
+ },
+ async channels() {
+ const providers = [
+ '',
+ 'premium/',
+ 'sky-intrattenimento/',
+ 'sky-sport/',
+ 'sky-cinema/',
+ 'sky-doc-e-lifestyle/',
+ 'sky-news/',
+ 'sky-bambini/',
+ 'sky-musica/',
+ 'sky-primafila/',
+ 'dazn/',
+ 'rsi/'
+ ]
+ const promises = providers.map(p => axios.get(`https://www.superguidatv.it/canali/${p}`))
+
+ const channels = []
+ await Promise.all(promises)
+ .then(responses => {
+ responses.forEach(r => {
+ const $ = cheerio.load(r.data)
+
+ $('.sgtvchannellist_mainContainer .sgtvchannel_divCell a').each((i, link) => {
+ let [_, site_id] = $(link)
+ .attr('href')
+ .match(/guida-programmi-tv-(.*)\/$/) || [null, null]
+ let name = $(link).find('.pchannel').text().trim()
+
+ channels.push({
+ lang: 'it',
+ site_id,
+ name
+ })
+ })
+ })
+ })
+ .catch(console.log)
+
+ return channels
+ }
+}
+
+function parseStart($item, date) {
+ const hours = $item('.sgtvchannelplan_hoursCell')
+ .clone()
+ .children('.sgtvOnairSpan')
+ .remove()
+ .end()
+ .text()
+ .trim()
+
+ return dayjs.tz(`${date.format('YYYY-MM-DD')} ${hours}`, `YYYY-MM-DD HH:mm`, 'Europe/Rome')
+}
+
+function parseTitle($item) {
+ return $item('.sgtvchannelplan_spanInfoNextSteps').text().trim()
+}
+
+function parseCategory($item) {
+ const eventType = $item('.sgtvchannelplan_spanEventType').text().trim()
+ const [_, category] = eventType.match(/(^[^\(]+)/) || [null, '']
+
+ return category.trim()
+}
+
+function parseItems(content) {
+ const $ = cheerio.load(content)
+
+ return $('.sgtvchannelplan_divContainer > .sgtvchannelplan_divTableRow')
+ .has('#containerInfoEvent')
+ .toArray()
+}
diff --git a/sites/superguidatv.it/superguidatv.it.test.js b/sites/superguidatv.it/superguidatv.it.test.js
new file mode 100644
index 00000000..64774f0c
--- /dev/null
+++ b/sites/superguidatv.it/superguidatv.it.test.js
@@ -0,0 +1,67 @@
+// npm run channels:parse -- --config=sites/superguidatv.it/superguidatv.it.config.js --output=sites/superguidatv.it/superguidatv.it.channels.xml
+// npx epg-grabber --config=sites/superguidatv.it/superguidatv.it.config.js --channels=sites/superguidatv.it/superguidatv.it.channels.xml --output=guide.xml --days=2
+
+const { parser, url } = require('./superguidatv.it.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-01-11', 'YYYY-MM-DD').startOf('d')
+const channel = {
+ site_id: 'virgin-radio/461',
+ xmltv_id: 'VirginRadioTV.it'
+}
+
+it('can generate valid url', () => {
+ expect(url({ channel, date })).toBe(
+ 'https://www.superguidatv.it/programmazione-canale/oggi/guida-programmi-tv-virgin-radio/461/'
+ )
+})
+
+it('can generate valid url for tomorrow', () => {
+ expect(url({ channel, date: date.add(1, 'd') })).toBe(
+ 'https://www.superguidatv.it/programmazione-canale/domani/guida-programmi-tv-virgin-radio/461/'
+ )
+})
+
+it('can generate valid url for after tomorrow', () => {
+ expect(url({ channel, date: date.add(2, 'd') })).toBe(
+ 'https://www.superguidatv.it/programmazione-canale/dopodomani/guida-programmi-tv-virgin-radio/461/'
+ )
+})
+
+it('can parse response', () => {
+ const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html'), 'utf8')
+ let results = parser({ content, date })
+ results = results.map(p => {
+ p.start = p.start.toJSON()
+ p.stop = p.stop.toJSON()
+ return p
+ })
+
+ expect(results[0]).toMatchObject({
+ start: '2023-01-11T01:00:00.000Z',
+ stop: '2023-01-11T05:00:00.000Z',
+ title: `All Nite Rock`,
+ category: 'Musica'
+ })
+
+ expect(results[13]).toMatchObject({
+ start: '2023-01-12T05:00:00.000Z',
+ stop: '2023-01-12T05:30:00.000Z',
+ title: `Free Rock`,
+ category: 'Musica'
+ })
+})
+
+it('can handle empty guide', () => {
+ const result = parser({
+ date,
+ content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.html'), 'utf8')
+ })
+ expect(result).toMatchObject([])
+})