Advertisement
voyeg3r

lotofacil.py

Jun 3rd, 2019
593
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. #  -*- coding: utf-8 -*-
  3. #         vim: ai ts=4 sts=4 et sw=4
  4. #    Filename: lotofacil.py
  5. #      Author: Sergio Araujo
  6.  
  7. # este script já funciona mas quero altera-lo para atender a dois propósitos:
  8.  
  9. # imprimir somente números
  10. # imprimir somente os 12 primeiros
  11.  
  12.  
  13. from bs4 import BeautifulSoup
  14. import requests
  15.  
  16. #url = input("Digite o link da página: ")
  17. ## page = requests.get('https://www.dataquest.io/blog/web-scraping-tutorial-python/')
  18.  
  19. url = 'https://asloterias.com.br/numeros-mais-sorteados-lotomania'
  20.  
  21. ## when the website does not allow command line access
  22. headers = {'User-Agent': 'Mozilla/5.0'}
  23.  
  24. page = requests.get(url, headers=headers)
  25. soup = BeautifulSoup(page.content, 'html.parser')
  26.  
  27. mydivs = soup.find_all("div", {"class": "tabela_zebrada"})
  28.  
  29. # ## print all page links
  30. # for link in soup.find_all("a"):
  31. #     print(link.get("href"))
  32.  
  33. for i in mydivs:
  34.     print(i.text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement