In [4]:
import requests as req
In [38]:
a = "http://www.fuvest.br/vest2014/js/qase_grupos_1_2_2014.js"
ano_inicial = 2013
ano_final = 2015
for ano in range(ano_inicial, ano_final+1):
url_base = "http://www.fuvest.br/vest%s/js/qase_%s.js" % (str(ano), str(ano))
url_quest = "http://www.fuvest.br/vest%s/js/qase_quest_%s.js" % (str(ano), str(ano))
r = req.get(url_quest)
r.encoding = "ISO-8859-1"
path = str(ano) + ".json"
out = r.text
out = out[out.index('['):]
with open(path, "w") as fid:
fid.write(out)
for i in range(1, 3):
for j in range(1, 5):
path = str(ano) + "_%i_%i.json" % (j, i)
url = "http://www.fuvest.br/vest%s/js/qase_grupos_%s_%s_%s.js" % (str(ano), str(j), str(i), str(ano))
r = req.get(url)
r.encoding = "ISO-8859-1"
out = r.text
out = out[out.index(';'):]
out = out[out.index('['):]
with open(path, "w") as fid:
fid.write(out)
In [34]:
a = r.encoding
In [35]:
a
In [ ]: