Last active
November 15, 2017 21:44
-
-
Save fmasanori/ee2b554ee6e05f298d5014bcbf730fd7 to your computer and use it in GitHub Desktop.
Lista de nomes de Pets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup as bs | |
import string | |
pets = [] | |
for pet in ('Gatos', 'Caes'): | |
for letra in string.ascii_uppercase: | |
for k in (1, 2, 3): | |
u = 'https://www.bayerpet.com.br/%s/lista-nomes/%s%s' %(pet, letra, str(k)) | |
p = requests.get(u) | |
s = bs(p.content, 'html.parser') | |
lista = s.find('ul', class_='list listNames') | |
nomes = lista.findAll('li') | |
pets.extend([n.string.lower() for n in nomes]) | |
pets = list(set(pets)) | |
pets.sort() | |
print (' '.join(pets)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment