Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Python
Posted by: Mario Lopes
Added: Jan 10, 2019 9:14 AM
Views: 28
  1. import requests
  2. from bs4 import BeautifulSoup
  3. headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'}
  4. pagina=requests.get("https://pt.investing.com/equities/", headers=headers)
  5. soup=BeautifulSoup(pagina.content,"html.parser")
  6. procura="td.pid-428-last"
  7. preco=soup.select_one(procura)
  8. #preco=soup.select_one("title")
  9. print(preco.text)