Skip to content

Instantly share code, notes, and snippets.

@gileno
Created August 18, 2018 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gileno/26fc4d5077c24395afc706f7916e06fc to your computer and use it in GitHub Desktop.
Save gileno/26fc4d5077c24395afc706f7916e06fc to your computer and use it in GitHub Desktop.
import urllib.request
import re
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/5
}
req = urllib.request.Request(url, headers=headers)
with urllib.request.urlopen(r) as response:
html = response.read().decode(‘utf-8’)
preco = re.findall(r'<input type="hidden" value="(.*)" id="taxa-comercial">', html)[0]
print(preco)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment