dataabc / weiboSpider

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

解决 'NoneType' object has no attribute 'xpath' #583

Closed zangwill closed 1 month ago

zangwill commented 1 month ago

handle_html 函数返回 Element 或者 None,page_parser.py 没有处理 None 的情况

'NoneType' object has no attribute 'xpath'
Traceback (most recent call last):
  File "C:\Users\zw\miniconda3\lib\site-packages\weibo_spider\spider.py", line 178, in get_weibo_info
    weibos, self.weibo_id_list, to_continue = PageParser(
  File "C:\Users\zw\miniconda3\lib\site-packages\weibo_spider\parser\page_parser.py", line 47, in __init__
    info = self.selector.xpath("//div[@class='c']")
AttributeError: 'NoneType' object has no attribute 'xpath'
dataabc commented 1 month ago

已merge,感谢贡献代码。