知乎爬虫入门报错问题simplejson.errors.JSONDecodeError:
老婆是云梦 2019-05-19 12:50:47 现在的知乎首页爬取变得越来越难了
ceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Program Files\JetBrains\PyCharm 2018.2.4\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "C:\Program Files\JetBrains\PyCharm 2018.2.4\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/1/PycharmProjects/python爬虫实战/知乎爬虫/zhihu.py", line 27, in <module>
get_user_data(10)
File "C:/Users/1/PycharmProjects/python爬虫实战/知乎爬虫/zhihu.py", line 21, in get_user_data
response = requests.get(url, headers=headers).json()['data']
File "C:\Users\1\AppData\Roaming\Python\Python37\site-packages\requests\models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Users\1\AppData\Local\Programs\Python\Python37\lib\site-packages\simplejson\__init__.py", line 518, in loads
return _default_decoder.decode(s)
File "C:\Users\1\AppData\Local\Programs\Python\Python37\lib\site-packages\simplejson\decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "C:\Users\1\AppData\Local\Programs\Python\Python37\lib\site-packages\simplejson\decoder.py", line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
这个问题哪位大佬能回答一下?
怎么解决知乎爬虫问题?