import json, requests
your_records = 3000 # change this record with that number you want ( that website said the max value is 312172 )
URL = "https://www.michigantrafficcrashfacts.org/qjson?q=1;0;2016;;&v=list&p=0,0:0,77|0|{0}|0,asc:1,asc".format(your_records)
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
get_data = requests.get(URL, headers=headers)
raw_data = str(get_data.content, encoding="utf-8")
dict_data = json.loads(raw_data)
for items, values in dict_data.items():
print(items, values)
你不需要做网页刮板,我观察到所有的请求,该网站,然后我解码这些请求与我的工具….,请参阅:
1)https://www.michigantrafficcrashfacts.org/qjson?q=1;0;2016;;&v=list&p=0,0:0,77|0|90|0,asc:1,asc| | 90记录为json
2)https://www.michigantrafficcrashfacts.org/qjson?q=1;0;2016;;&v=list&p=0,0:0,77|0|2000|0,asc:1,asc ||2000条记录为json
注意:请不要在非法或黑客案件中使用。
相关问题 更多 >
编程相关推荐