Open idjd2018 opened 1 year ago
I got this issue too....how to fix?
i checked the url responese,found the response is not a json, because the url is expire
就是说url过期啦,url不能用了,返回的对象不是json了,所以没法解析了
replace url to 'https://api.m.jd.com/client.action?functionId=queryMaterialProducts&client=wh5' and it response a json data besides, add user-agent in the headers maybe better 'headers = { "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36" } '
replace url to 'https://api.m.jd.com/client.action?functionId=queryMaterialProducts&client=wh5' and it response a json data besides, add user-agent in the headers maybe better 'headers = { "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36" } '
大佬哪里替换这个路径
replace url to 'https://api.m.jd.com/client.action?functionId=queryMaterialProducts&client=wh5' and it response a json data besides, add user-agent in the headers maybe better 'headers = { "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36" } '
'{"code":"2","echo":"the current API does not exist"}' API不存在了啊
功能列表: 1.预约商品 2.秒杀抢购商品
Traceback (most recent call last): File "main.py", line 32, in
jd_seckill = JdSeckill()
File "/Users/Glen/Develop/python/jd_maotai_seckill-master/jd_spider_requests.py", line 278, in init
self.timers = Timer()
File "/Users/Glen/Develop/python/jd_maotai_seckill-master/timer.py", line 24, in init
self.diff_time = self.local_jd_time_diff()
File "/Users/Glen/Develop/python/jd_maotai_seckill-master/timer.py", line 48, in local_jd_time_diff
return self.local_time() - self.jd_time()
File "/Users/Glen/Develop/python/jd_maotai_seckill-master/timer.py", line 33, in jd_time
js = json.loads(ret)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)