|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 shangrilas 于 2020-6-6 18:18 编辑
大佬们,写个小爬虫解析出错,这个是啥问题啊
==========================================
import requests
import re
import pprint
# 浏览器伪装
headers = {
'user-agent': '"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"'}
#根据网址请求服务器
response = requests.get('https://audio.cos.xmcdn.com/group13/M08/2E/78/wKgDXVWLdzjzPG8AAI-xxBikPHE089.m4a',headers=headers)
#字典类型
data = response.json()
#漂亮的打印
pprint.pprint(data)
=======================================
报错内容
Traceback (most recent call last):
File "F:/PythonProject/ximalaya.py", line 11, in <module>
data = response.json()
File "D:\Python\Install\lib\site-packages\requests\models.py", line 898, in json
return complexjson.loads(self.text, **kwargs)
File "D:\Python\Install\lib\json\__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "D:\Python\Install\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "D:\Python\Install\lib\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)
Process finished with exit code 1
|
|