Skip to content

Instantly share code, notes, and snippets.

@fmasanori
Last active November 15, 2017 21:44
Show Gist options
  • Save fmasanori/ee2b554ee6e05f298d5014bcbf730fd7 to your computer and use it in GitHub Desktop.
Save fmasanori/ee2b554ee6e05f298d5014bcbf730fd7 to your computer and use it in GitHub Desktop.
Lista de nomes de Pets
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