weiboSpider icon indicating copy to clipboard operation
weiboSpider copied to clipboard

运行出错请求帮助

Open LIzx-666 opened this issue 4 months ago • 2 comments

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

  • 问:请您指明哪个版本运行出错(github版/PyPi版/全部)? githun 答:

  • 问:您使用的是否是最新的程序(是/否)? 是 答:

  • 问:爬取任意用户都会运行出错吗(是/否)? 是 答:

  • 问:若只有爬特定微博时才出错,能否提供出错微博的weibo_id或url(非必填)?

答:

  • 问:若您已提供出错微博的weibo_id或url,可忽略此内容,否则能否提供出错账号的user_id及您配置的since_date,方便我们定位出错微博(非必填)?

答:

  • 问:如果方便,请您描述出错详情,最好附上错误提示。

答:出错提示为'NoneType' object has no attribute 'xpath' Traceback (most recent call last): File "D:\PyCharm 2024.3.5\python\lib\site-packages\weibo_spider\parser\index_parser.py", line 33, in get_user user_id = self._get_user_id() File "D:\PyCharm 2024.3.5\python\lib\site-packages\weibo_spider\parser\index_parser.py", line 20, in _get_user_id url_list = self.selector.xpath("//div[@class='u']//a") AttributeError: 'NoneType' object has no attribute 'xpath' None


'NoneType' object has no attribute 'nickname' Traceback (most recent call last): File "D:\PyCharm 2024.3.5\python\lib\site-packages\weibo_spider\spider.py", line 226, in _get_filepath dir_name = self.user.nickname AttributeError: 'NoneType' object has no attribute 'nickname' expected str, bytes or os.PathLike object, not NoneType Traceback (most recent call last): File "D:\PyCharm 2024.3.5\python\lib\site-packages\weibo_spider\writer\csv_writer.py", line 25, in init with open(self.file_path, 'a', encoding='utf-8-sig', TypeError: expected str, bytes or os.PathLike object, not NoneType


'NoneType' object has no attribute 'xpath' Traceback (most recent call last): File "D:\PyCharm 2024.3.5\python\lib\site-packages\weibo_spider\parser\index_parser.py", line 49, in get_page_num if self.selector.xpath("//input[@name='mp']") == []: AttributeError: 'NoneType' object has no attribute 'xpath' unsupported operand type(s) for +: 'NoneType' and 'int' Traceback (most recent call last): File "D:\PyCharm 2024.3.5\python\lib\site-packages\weibo_spider\spider.py", line 177, in get_weibo_info for page in tqdm(range(1, page_num + 1), desc='Progress'): TypeError: unsupported operand type(s) for +: 'NoneType' and 'int' 共爬取0条微博 信息抓取完毕


使用了最新的cookie,并调节了时间间隔,同样的cookie可以进行weibo search的运行,只有这个weibospider会这样子报错

LIzx-666 avatar Aug 06 '25 18:08 LIzx-666

可能是接口不同,限制不一样吧,一般这种错误是被暂时限制,过一段时间限制会自动解除,您也可以使用weibo-crawler。

dataabc avatar Aug 07 '25 07:08 dataabc

是从github下载的最新的

虫二 @.***

---原始邮件--- 发件人: "Chen @.> 发送时间: 2025年8月7日(周四) 下午3:26 收件人: @.>; 抄送: @.@.>; 主题: Re: [dataabc/weiboSpider] 运行出错请求帮助 (Issue #665)

dataabc left a comment (dataabc/weiboSpider#665)

使用的是最新版本的程序吗

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

LIzx-666 avatar Aug 07 '25 11:08 LIzx-666