Created
April 6, 2020 21:54
-
-
Save theagoliveira/a984f49b81832f2ed2311c8d5a2de659 to your computer and use it in GitHub Desktop.
Get the number of available products on MercadoLivre, using the URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Get the number of available products on MercadoLivre, using the URL | |
""" | |
import re | |
import sys | |
import urllib.request as req | |
p_url = sys.argv[1] | |
with req.urlopen(p_url) as resp: | |
p_src = resp.read().decode("utf-8") | |
n_available = re.findall('quantity-available">\((.*)\)</span>', p_src)[0] | |
print(n_available) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment