There was an error in judging the status
The content could not be obtained because of the web page revision, and the modification is as follows:
while not ok:
try:
response = requests.get(url = url, headers = headers)
print(url,response.status_code)
if response.status_code == 200:
res = etree.HTML(response.text)
res = res.xpath("//script[2]//text()")[0]
res = json.loads(res[17:])
res = pd.Series(res).to_frame().T
ok = True
return res
except :
pass
I made two changes:
There was an error in judging the status The content could not be obtained because of the web page revision, and the modification is as follows: