+
+
+
+
+
+
500
+
+
+
+ Estamos com Problemas de Conexão
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Modo
+ Dark
+ Ative o modo Dark e deixe a tala escura.
+ O modo escuro ajudará o seu dispositivo a economizar bateria e reduzir a tensão dos seus
+ olhos.
+
+
+
+
+
Versão do site 1.2.2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 2c51e8fadb73da2e29ae0152db41675f4da28485 Mon Sep 17 00:00:00 2001
From: freearhey <7253922+freearhey@users.noreply.github.com>
Date: Thu, 16 Jan 2025 02:38:47 +0300
Subject: [PATCH 3/6] Create guiadetv.com.test.js
---
sites/guiadetv.com/guiadetv.com.test.js | 80 +++++++++++++++++++++++++
1 file changed, 80 insertions(+)
create mode 100644 sites/guiadetv.com/guiadetv.com.test.js
diff --git a/sites/guiadetv.com/guiadetv.com.test.js b/sites/guiadetv.com/guiadetv.com.test.js
new file mode 100644
index 00000000..d28bd6dd
--- /dev/null
+++ b/sites/guiadetv.com/guiadetv.com.test.js
@@ -0,0 +1,80 @@
+const { parser, url } = require('./guiadetv.com.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('2025-01-18', 'YYYY-MM-DD').startOf('d')
+const channel = {
+ site_id: 'canal-rural',
+ xmltv_id: 'CanalRural.br'
+}
+
+it('can generate valid url', () => {
+ expect(url({ channel })).toBe('https://www.guiadetv.com/canal/canal-rural')
+})
+
+it('can parse response', () => {
+ const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html'))
+ const results = parser({ content, date }).map(p => {
+ p.start = p.start.toJSON()
+ p.stop = p.stop.toJSON()
+ return p
+ })
+
+ expect(results.length).toBe(16)
+ expect(results[0]).toMatchObject({
+ start: '2025-01-18T03:00:00.000Z',
+ stop: '2025-01-18T04:00:00.000Z',
+ title: 'Leilão',
+ description: null,
+ category: null
+ })
+ expect(results[2]).toMatchObject({
+ start: '2025-01-18T06:00:00.000Z',
+ stop: '2025-01-18T09:00:00.000Z',
+ title: 'TV Verdade',
+ description: null,
+ category: 'Jornalismo'
+ })
+ expect(results[15]).toMatchObject({
+ start: '2025-01-19T00:00:00.000Z',
+ stop: '2025-01-19T00:30:00.000Z',
+ title: 'Leilão',
+ description: null,
+ category: null
+ })
+})
+
+it('can parse response for current day', () => {
+ const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html'))
+ const results = parser({ content, date: dayjs.utc('2025-01-15', 'YYYY-MM-DD').startOf('d') }).map(
+ p => {
+ p.start = p.start.toJSON()
+ p.stop = p.stop.toJSON()
+ return p
+ }
+ )
+
+ expect(results.length).toBe(7)
+ expect(results[0]).toMatchObject({
+ start: '2025-01-15T21:15:00.000Z',
+ stop: '2025-01-15T21:45:00.000Z',
+ title: 'Planeta Campo Talks',
+ description:
+ 'Grandes reportagens, notícias, entrevistas e debates com foco em ações de sustentabilidade e indicadores ESG. Informações para apoiar o produtor rural a plantar e criar com olhar para o futuro.',
+ category: null
+ })
+})
+
+it('can handle empty guide', () => {
+ const results = parser({
+ date,
+ content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.html'))
+ })
+
+ expect(results).toMatchObject([])
+})
From c56b0a1ed861e39f3f12732288b6570d749099b3 Mon Sep 17 00:00:00 2001
From: freearhey <7253922+freearhey@users.noreply.github.com>
Date: Thu, 16 Jan 2025 02:39:39 +0300
Subject: [PATCH 4/6] Create guiadetv.com.config.js
---
sites/guiadetv.com/guiadetv.com.config.js | 101 ++++++++++++++++++++++
1 file changed, 101 insertions(+)
create mode 100644 sites/guiadetv.com/guiadetv.com.config.js
diff --git a/sites/guiadetv.com/guiadetv.com.config.js b/sites/guiadetv.com/guiadetv.com.config.js
new file mode 100644
index 00000000..b63f49b2
--- /dev/null
+++ b/sites/guiadetv.com/guiadetv.com.config.js
@@ -0,0 +1,101 @@
+const cheerio = require('cheerio')
+const axios = require('axios')
+const dayjs = require('dayjs')
+const customParseFormat = require('dayjs/plugin/customParseFormat')
+
+dayjs.extend(customParseFormat)
+
+require('dayjs/locale/pt')
+
+module.exports = {
+ site: 'guiadetv.com',
+ days: 2,
+ url({ channel }) {
+ return `https://www.guiadetv.com/canal/${channel.site_id}`
+ },
+ parser({ content, date }) {
+ const programs = []
+ const items = parseItems(content, date)
+ items.forEach(item => {
+ const prev = programs[programs.length - 1]
+ const $item = cheerio.load(item)
+ const title = parseTitle($item)
+ let start = parseStart($item)
+ if (!start || !title) return
+ if (prev) {
+ prev.stop = start
+ }
+ const stop = start.add(30, 'm')
+
+ programs.push({
+ title,
+ description: parseDescription($item),
+ category: parseCategory($item),
+ start,
+ stop
+ })
+ })
+
+ return programs
+ },
+ async channels() {
+ const categories = [
+ 'variedades',
+ 'tv-aberta',
+ 'noticias',
+ 'infantil',
+ 'filmes-e-series',
+ 'esportes',
+ 'documentarios'
+ ]
+ const promises = categories.map(category =>
+ axios.get(`https://www.guiadetv.com/categorias/${category}.html`)
+ )
+
+ const channels = []
+ const results = await Promise.all(promises).catch(console.log)
+ results.forEach(r => {
+ const $ = cheerio.load(r.data)
+ $('.cardchannel').each((i, el) => {
+ const link = $(el).find('a')
+ const name = link.attr('title')
+ const url = link.attr('href')
+ const site_id = url.replace('https://www.guiadetv.com/canal/', '')
+
+ channels.push({
+ lang: 'pt',
+ name,
+ site_id
+ })
+ })
+ })
+
+ return channels
+ }
+}
+
+function parseTitle($item) {
+ return $item('h3').text().trim()
+}
+
+function parseDescription($item) {
+ return $item('p').clone().children().remove().end().text().trim() || null
+}
+
+function parseCategory($item) {
+ return $item('p > i').text().trim() || null
+}
+
+function parseStart($item) {
+ const dt = $item('b span:nth-child(1)').data('dt') || $item('b').data('dt')
+ if (!dt) return null
+
+ return dayjs(dt, 'YYYY-MM-DD HH:mm:ssZ')
+}
+
+function parseItems(content, date) {
+ const $ = cheerio.load(content)
+ const localDate = date.locale('pt').format('D MMMM YYYY')
+
+ return $(`.row:contains(${localDate})`).nextUntil('.row:not(.mt-1)').toArray()
+}
From 885a5593d3eb4281c9ed9ca8b2cd1441f7e30943 Mon Sep 17 00:00:00 2001
From: freearhey <7253922+freearhey@users.noreply.github.com>
Date: Thu, 16 Jan 2025 02:39:56 +0300
Subject: [PATCH 5/6] Create guiadetv.com.channels.xml
---
sites/guiadetv.com/guiadetv.com.channels.xml | 127 +++++++++++++++++++
1 file changed, 127 insertions(+)
create mode 100644 sites/guiadetv.com/guiadetv.com.channels.xml
diff --git a/sites/guiadetv.com/guiadetv.com.channels.xml b/sites/guiadetv.com/guiadetv.com.channels.xml
new file mode 100644
index 00000000..ea316734
--- /dev/null
+++ b/sites/guiadetv.com/guiadetv.com.channels.xml
@@ -0,0 +1,127 @@
+
+
+ A&E
+ Agro+
+ AMC
+ Animal Planet
+ Arte 1
+ AXN
+ Band
+ Bandnews
+ Bandsports
+ BBC World
+ Bis
+ Bloomberg
+ Box Kids
+ Canal Educação
+ Canal Rural
+ Canção Nova
+ Cartoon Network
+ Cartoonito
+ Cinecanal
+ Cinemax
+ CNN Brasil
+ Combate
+ Comedy Central
+ Curta!
+ Discovery Channel
+ Discovery Home & Health
+ Discovery Kids
+ Discovery Science
+ Discovery Theater
+ Discovery Turbo
+ Discovery World
+ Disney
+ E!
+ ESPN
+ ESPN 2
+ ESPN 3
+ ESPN 4
+ ESPN 5
+ ESPN 6
+ Film & Arts
+ Food Network
+ Fox News
+ Futura
+ FX
+ Globo
+ Globo News
+ Gloob
+ Gloobinho
+ GNT
+ HBO
+ HBO 2
+ HBO Family
+ HBO Mundi
+ HBO Plus
+ HBO Pop
+ HBO Signature
+ HBO Xtreme
+ HGTV
+ History
+ History 2
+ Investigação Discovery
+ Jovem Pan News
+ Lifetime
+ Megapix
+ MTV
+ MTV LIVE
+ Multishow
+ National Geographic
+ Nick Jr.
+ Nickelodeon
+ Off
+ Paramount Network
+ Premiere 2
+ Premiere 3
+ Premiere 4
+ Premiere 5
+ Premiere 6
+ Premiere 7
+ Premiere FC
+ Prime Box Brazil
+ Record News
+ Record TV
+ Rede Brasil
+ Rede Família
+ Rede Gospel
+ Rede Século 21
+ Rede TV
+ Rede Vida
+ SBT
+ Sony
+ SONY Movies
+ Space
+ SporTV
+ SporTV 2
+ SporTV 3
+ STAR Channel
+ Studio Universal
+ Syfy
+ TCM
+ Telecine Action
+ Telecine Cult
+ Telecine Fun
+ Telecine Pipoca
+ Telecine Premium
+ Telecine Touch
+ Terra Viva
+ TLC
+ TNT
+ TNT Novelas
+ TNT Séries
+ Tooncast
+ Travel Box Brasil
+ truTV
+ TV Aparecida
+ TV Brasil
+ TV Câmara
+ TV Cultura
+ Tv Gazeta
+ TV Rá Tim Bum
+ TV Senado
+ Universal TV
+ Viva
+ Warner
+ Woohoo
+
From 415aa3d476cde0491388209a255857a965c050d9 Mon Sep 17 00:00:00 2001
From: freearhey <7253922+freearhey@users.noreply.github.com>
Date: Thu, 16 Jan 2025 02:40:10 +0300
Subject: [PATCH 6/6] Create readme.md
---
sites/guiadetv.com/readme.md | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 sites/guiadetv.com/readme.md
diff --git a/sites/guiadetv.com/readme.md b/sites/guiadetv.com/readme.md
new file mode 100644
index 00000000..0fafd64f
--- /dev/null
+++ b/sites/guiadetv.com/readme.md
@@ -0,0 +1,21 @@
+# guiadetv.com
+
+https://www.guiadetv.com/programacao/
+
+### Download the guide
+
+```sh
+npm run grab --- --site=guiadetv.com
+```
+
+### Update channel list
+
+```sh
+npm run channels:parse --- --config=./sites/guiadetv.com/guiadetv.com.config.js --output=./sites/guiadetv.com/guiadetv.com.channels.xml
+```
+
+### Test
+
+```sh
+npm test --- guiadetv.com
+```