Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from bs4 import BeautifulSoup
- from urllib.request import Request, urlopen
- from io import StringIO
- ## usando Request e bs4
- link = Request('https://rduirapuru.com.br/geral/fim-do-impasse-empresa-confirma-execucao-do-projeto-para-o-aeroporto-de-passo-fundo-e-estado-da-prazo-para-documentos/',
- headers={'User-Agent': 'Mozilla/5.0'})
- pagina = urlopen(link).read().decode('utf-8', 'ignore')
- soup = BeautifulSoup(pagina, "lxml")
- paragrafos = soup.find("article").find_all('p')
- texto_buf = StringIO()
- for p in paragrafos:
- texto_buf.write(p.text + " ")
- texto = texto_buf.getvalue()
- print(texto)
Add Comment
Please, Sign In to add comment