wzdyjn 发表于 2022-10-28 19:58:33

python爬取东方财富网返回数据不能转json

url=f'http://1.push2.eastmoney.com/api/qt/clist/get?cb=jQuery112409400485999513473_1666888866635&pn=1&pz=20&po=1&np=1&ut=bd1d9ddb04089700cf9c27f6f7426281&fltt=2&invt=2&wbp2u=|0|0|0|web&fid=f3&fs=m:0+t:6,m:0+t:80&fields=f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152&_=1666888866749'
   
resp=requests.get(url=url,headers=herader).text


返回的数据没法转换为json格式

临时号 发表于 2022-10-29 13:27:26

import requests
import json

headers = {
    "User-Agent":"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"
}

url=f'https://1.push2.eastmoney.com/api/qt/clist/get?pn=1&pz=20&po=1&np=1&ut=bd1d9ddb04089700cf9c27f6f7426281&fltt=2&invt=2&wbp2u=|0|0|0|web&fid=f3&fs=m:0+t:6,m:0+t:80&fields=f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152&_=1666888866749'
   
resp=requests.get(url=url,headers=headers).json()
print(resp)
页: [1]
查看完整版本: python爬取东方财富网返回数据不能转json