dataabc / weiboSpider

新浪微博爬虫,用python爬取新浪微博数据
8.37k stars 1.98k forks source link

刚刚重新下载最新,不能正常运行 #182

Closed gudaocode closed 4 years ago

gudaocode commented 4 years ago

为了更好的解决问题,请认真回答下面的问题。等到问题解决,请及时关闭本issue。

Error: list index out of range Traceback (most recent call last): File "X:\Program Files\Pic_Follow_WeiBo\Cookie版\weibo_spider\parser\info_parser.py", line 37, in extract_user_info if self.selector.xpath( IndexError: list index out of range Error: 'NoneType' object has no attribute 'id' Traceback (most recent call last): File "X:\Program Files\Pic_Follow_WeiBo\Cookie版\weibo_spider\parser\index_parser.py", line 34, in get_user self.user.id = user_id AttributeError: 'NoneType' object has no attribute 'id' None


Error: 'NoneType' object has no attribute 'nickname' Traceback (most recent call last): File "X:\Program Files\Pic_Follow_WeiBo\Cookie版\weibo_spider\spider.py", line 137, in _get_filepath self.user.nickname) AttributeError: 'NoneType' object has no attribute 'nickname' Error: expected str, bytes or os.PathLike object, not NoneType Traceback (most recent call last): File "X:\Program Files\Pic_Follow_WeiBo\Cookie版\weibo_spider\writer\csv_writer.py", line 23, in init with open(self.file_path, "a", encoding="utf-8-sig", TypeError: expected str, bytes or os.PathLike object, not NoneType Error: 'NoneType' object has no attribute 'nickname' Traceback (most recent call last): File "X:\Program Files\Pic_Follow_WeiBo\Cookie版\weibo_spider\spider.py", line 137, in _get_filepath self.user.nickname) AttributeError: 'NoneType' object has no attribute 'nickname'


Progress: 0%| | 0/50 [00:00<?, ?it/s] Error: 'NoneType' object has no attribute 'nickname' Traceback (most recent call last): File "X:\Program Files\Pic_Follow_WeiBo\Cookie版\weibo_spider\spider.py", line 109, in get_weibo_info self.user.nickname, AttributeError: 'NoneType' object has no attribute 'nickname' 共爬取0条微博 信息抓取完毕

dataabc commented 4 years ago

感谢反馈。

可能原因有两个:

1.config.json中的user_id_list不正确,如果想填写文件路径,应该是字符串,如果想填user_id,应该是列表; 2.速度太快,降低速度就可以,参考常见问题的第二个问题。

如果还有问题或建议,欢迎继续讨论

gudaocode commented 4 years ago

多谢!是json文件里面配置错了,使用的"user_id_list.txt"结果忘记去掉[]了,不好意思