You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
答:我尝试在爬两个ID,上面提供的这个ID没法正常爬取,但是另一个ID可以正常爬取
报错如下:
(base) liangzhi@zhiliang14 ~ % python3 -m weibo_spider --output_dir="/Users/liangzhi/Desktop/微博爬虫"
'NoneType' object has no attribute 'xpath'
Traceback (most recent call last):
File "/Users/liangzhi/anaconda3/lib/python3.11/site-packages/weibo_spider/parser/index_parser.py", line 33, in get_user
user_id = self._get_user_id()
^^^^^^^^^^^^^^^^^^^
File "/Users/liangzhi/anaconda3/lib/python3.11/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 "/Users/liangzhi/anaconda3/lib/python3.11/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 "/Users/liangzhi/anaconda3/lib/python3.11/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 'nickname'
Traceback (most recent call last):
File "/Users/liangzhi/anaconda3/lib/python3.11/site-packages/weibo_spider/spider.py", line 226, in _get_filepath
dir_name = self.user.nickname
^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'nickname'
'NoneType' object has no attribute 'dict'
Traceback (most recent call last):
File "/Users/liangzhi/anaconda3/lib/python3.11/site-packages/weibo_spider/spider.py", line 313, in get_one_user
self.write_user(self.user)
File "/Users/liangzhi/anaconda3/lib/python3.11/site-packages/weibo_spider/spider.py", line 137, in write_user
writer.write_user(user)
File "/Users/liangzhi/anaconda3/lib/python3.11/site-packages/weibo_spider/writer/txt_writer.py", line 29, in write_user
[v + ':' + str(self.user.dict[k]) for k, v in self.user_desc])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/liangzhi/anaconda3/lib/python3.11/site-packages/weibo_spider/writer/txt_writer.py", line 29, in
[v + ':' + str(self.user.dict[k]) for k, v in self.user_desc])
^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'dict'
期待您的回复~谢谢
The text was updated successfully, but these errors were encountered:
为了更好的解决问题,请认真回答下面的问题。等到问题解决,请及时关闭本issue。
答:github
答:是
答:否
答:5724107516
答:
答:我尝试在爬两个ID,上面提供的这个ID没法正常爬取,但是另一个ID可以正常爬取
报错如下:
(base) liangzhi@zhiliang14 ~ % python3 -m weibo_spider --output_dir="/Users/liangzhi/Desktop/微博爬虫"
'NoneType' object has no attribute 'xpath'
Traceback (most recent call last):
File "/Users/liangzhi/anaconda3/lib/python3.11/site-packages/weibo_spider/parser/index_parser.py", line 33, in get_user
user_id = self._get_user_id()
^^^^^^^^^^^^^^^^^^^
File "/Users/liangzhi/anaconda3/lib/python3.11/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 "/Users/liangzhi/anaconda3/lib/python3.11/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 "/Users/liangzhi/anaconda3/lib/python3.11/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 'nickname'
Traceback (most recent call last):
File "/Users/liangzhi/anaconda3/lib/python3.11/site-packages/weibo_spider/spider.py", line 226, in _get_filepath
dir_name = self.user.nickname
^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'nickname'
'NoneType' object has no attribute 'dict'
Traceback (most recent call last):
File "/Users/liangzhi/anaconda3/lib/python3.11/site-packages/weibo_spider/spider.py", line 313, in get_one_user
self.write_user(self.user)
File "/Users/liangzhi/anaconda3/lib/python3.11/site-packages/weibo_spider/spider.py", line 137, in write_user
writer.write_user(user)
File "/Users/liangzhi/anaconda3/lib/python3.11/site-packages/weibo_spider/writer/txt_writer.py", line 29, in write_user
[v + ':' + str(self.user.dict[k]) for k, v in self.user_desc])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/liangzhi/anaconda3/lib/python3.11/site-packages/weibo_spider/writer/txt_writer.py", line 29, in
[v + ':' + str(self.user.dict[k]) for k, v in self.user_desc])
^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'dict'
期待您的回复~谢谢
The text was updated successfully, but these errors were encountered: