I'm trying to write a code that picks news headlines from the G1 and prints on the screen. The problem is that G1 uses incomplete termination ( ... ), ex:
<a class=(...) title="Marcelo Bretas acolhe pedido de transferência de Sérgio Cabral para presídio federal" href=(...)">Marcelo Bretas acolhe pedido de transferência de Sérgio Cabral...</a>
However, the "title" attribute contains complete. How to use BeautifulSoup to get the value of the "title" attribute and printar on the screen?
What I have so far
import bs4, requests
link = 'http://g1.globo.com/busca/?q='
termo = 'sergio cabral' #Exemplo
completo = link + termo
pegar = requests.get(completo)
pegar.raise_for_status()
soup = bs4.BeautifulSoup(pegar.text, 'html5lib')
selec = soup.select(¯\_(ツ)_/¯)