Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ from bs4 import BeautifulSoup
|
|
5 |
|
6 |
# Função para raspar as notícias do Portal do Holanda
|
7 |
def scrape_news():
|
|
|
8 |
|
9 |
try:
|
10 |
# Adicionando um timeout de 10 segundos
|
@@ -26,7 +27,7 @@ def scrape_news():
|
|
26 |
titulo_text = titulo.text.strip() if titulo else "Sem título"
|
27 |
subtitulo = noticia.find('a', attrs={'class': 'destaque relacionada'})
|
28 |
subtitulo_text = subtitulo.text.strip() if subtitulo else "Sem subtítulo"
|
29 |
-
link = titulo['href'] if titulo else "#"
|
30 |
hora = noticia.find('p', attrs={'class': 'destaque ha'})
|
31 |
hora_text = hora.text.strip() if hora else "Sem horário de postagem"
|
32 |
|
|
|
5 |
|
6 |
# Função para raspar as notícias do Portal do Holanda
|
7 |
def scrape_news():
|
8 |
+
url = 'https://www.portaldoholanda.com.br/'
|
9 |
|
10 |
try:
|
11 |
# Adicionando um timeout de 10 segundos
|
|
|
27 |
titulo_text = titulo.text.strip() if titulo else "Sem título"
|
28 |
subtitulo = noticia.find('a', attrs={'class': 'destaque relacionada'})
|
29 |
subtitulo_text = subtitulo.text.strip() if subtitulo else "Sem subtítulo"
|
30 |
+
link = url + titulo['href'] if titulo else "#"
|
31 |
hora = noticia.find('p', attrs={'class': 'destaque ha'})
|
32 |
hora_text = hora.text.strip() if hora else "Sem horário de postagem"
|
33 |
|