2
I need to extract all the names of people on this site:
I wrote this code in Python3:
from urllib.request import urlopen
from bs4 import BeautifulSoup
import urllib.request, urllib.parse, urllib.error
emendas = urlopen("http://www.camara.gov.br/proposicoesWeb/prop_emendas?idProposicao=2122076&subst=0")
bsObje = BeautifulSoup(emendas, "lxml")
tabelas = bsObje.findAll("tbody", {"class":"coresAlternadas"})
deputados = []
for linha in tabelas:
deputados.append(linha.select('td')[3].text.strip())
print(deputados)
Resultado -> ['Laura Carneiro', 'André Figueiredo']
It didn’t work. Please, someone knows how to get all the names in order?
Thanks, it worked. But if I want to also extract the last batch of ('tbody', {'class': 'coresAlternadas'}), which has 32 more names in the Author column. Do I find just that lot? How?
– Reinaldo Chaves
@Reinaldochaves, ha I realized, two years ago
tbody
, and the last one is the plenary, you want the names of that one too?– Miguel
Edited for this @Reinaldochaves.
– Miguel