weibo-search
weibo-search copied to clipboard
小白求问,TypeError: expected string or bytes-like object 这是什么意思
运行之后出现这个
D:\python work\weibo-search-master>scrapy crawl search
2022-04-17 20:17:15 [scrapy.core.scraper] ERROR: Spider error processing <GET https://s.weibo.com/weibo?q=%E4%B8%8A%E6%B5%B7%E7%96%AB%E6%83%85&typeall=1&suball=1×cope=custom:2022-04-15-10:2022-04-15-11&page=1> (referer: https://s.weibo.com/weibo?q=%E4%B8%8A%E6%B5%B7%E7%96%AB%E6%83%85&typeall=1&suball=1×cope=custom:2022-04-15-0:2022-04-16-0&page=1)
Traceback (most recent call last):
File "D:\anaconda\lib\site-packages\scrapy\utils\defer.py", line 132, in iter_errback
yield next(it)
File "D:\anaconda\lib\site-packages\scrapy\utils\python.py", line 354, in next
return next(self.data)
File "D:\anaconda\lib\site-packages\scrapy\utils\python.py", line 354, in next
return next(self.data)
File "D:\anaconda\lib\site-packages\scrapy\core\spidermw.py", line 66, in _evaluate_iterable
for r in iterable:
File "D:\anaconda\lib\site-packages\scrapy\spidermiddlewares\offsite.py", line 29, in process_spider_output
for x in result:
File "D:\anaconda\lib\site-packages\scrapy\core\spidermw.py", line 66, in _evaluate_iterable
for r in iterable:
File "D:\anaconda\lib\site-packages\scrapy\spidermiddlewares\referer.py", line 342, in
貌似没有得到数据,不知道是不是cookie不正确。
更新了cookie就好了,谢谢!
我和你的问题一样,cookie更新了也没用 该如何解决呢
@yxxy0721 之前有成功过吗?可能还是cookie不正确。
没有成功过,一直是这个问题
发自我的iPhone
------------------ 原始邮件 ------------------ 发件人: Chen Lei @.> 发送时间: 2022年4月20日 23:43 收件人: dataabc/weibo-search @.> 抄送: yxxy0721 @.>, Mention @.> 主题: Re: [dataabc/weibo-search] 小白求问,TypeError: expected string or bytes-like object 这是什么意思 (Issue #192)
@yxxy0721 之前有成功过吗?可能还是cookie不正确。
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
@yxxy0721 可能是cookie的原因或者账号被限制了,你可以在我的weiboSpider程序上看看,是否能成功,成功了cookie就没问题。
同样的cookie spider就没问题
发自我的iPhone
------------------ 原始邮件 ------------------ 发件人: Chen Lei @.> 发送时间: 2022年4月21日 23:25 收件人: dataabc/weibo-search @.> 抄送: yxxy0721 @.>, Mention @.> 主题: Re: [dataabc/weibo-search] 小白求问,TypeError: expected string or bytes-like object 这是什么意思 (Issue #192)
@yxxy0721 可能是cookie的原因或者账号被限制了,你可以在我的weiboSpider程序上看看,是否能成功,成功了cookie就没问题。
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
@yxxy0721 是不是修改settings.py文件的COOKIES_ENABLED了?
是滴
发自我的iPhone
------------------ 原始邮件 ------------------ 发件人: Chen Lei @.> 发送时间: 2022年4月21日 23:49 收件人: dataabc/weibo-search @.> 抄送: yxxy0721 @.>, Mention @.> 主题: Re: [dataabc/weibo-search] 小白求问,TypeError: expected string or bytes-like object 这是什么意思 (Issue #192)
@yxxy0721 是不是修改settings.py文件的COOKIES_ENABLED了?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
@yxxy0721 @ajingjing145 COOKIES_ENABLED保持默认值,不要修改
感谢 我明天去看看
发自我的iPhone
------------------ 原始邮件 ------------------ 发件人: Chen Lei @.> 发送时间: 2022年4月21日 23:51 收件人: dataabc/weibo-search @.> 抄送: yxxy0721 @.>, Mention @.> 主题: Re: [dataabc/weibo-search] 小白求问,TypeError: expected string or bytes-like object 这是什么意思 (Issue #192)
@yxxy0721 @ajingjing145 COOKIES_ENABLED保持默认值,不要修改
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
我也遇到这个问题了,然后我把每个re.findall(r'\d+.',attitudes_count)都改成了re.findall(r'\d+.', str(attitudes_count))就解决了。
我也遇到这个问题了,然后我把每个re.findall(r'\d+.',attitudes_count)都改成了re.findall(r'\d+.', str(attitudes_count))就解决了。
这是那个文件的代码? 前面的方法我都试过了 还是这样子
search.py里面的,所有类似于re.findall(r'\d+.',XXX)的改成了re.findall(r'\d+.',str(XXX)。 (然后程序就不报错了,我也不知道为啥(●—●))
---原始邮件--- 发件人: @.> 发送时间: 2022年4月22日(周五) 晚上10:59 收件人: @.>; 抄送: @.@.>; 主题: Re: [dataabc/weibo-search] 小白求问,TypeError: expected string or bytes-like object 这是什么意思 (Issue #192)
我也遇到这个问题了,然后我把每个re.findall(r'\d+.',attitudes_count)都改成了re.findall(r'\d+.', str(attitudes_count))就解决了。
这是那个文件的代码? 前面的方法我都试过了 还是这样子
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
查到了 https://blog.csdn.net/K_Lily/article/details/105563869
search.py里面的,所有类似于re.findall(r'\d+.',XXX)的改成了re.findall(r'\d+.',str(XXX)。 (然后程序就不报错了,我也不知道为啥(●—●)) … ---原始邮件--- 发件人: @.> 发送时间: 2022年4月22日(周五) 晚上10:59 收件人: @.>; 抄送: @.@.>; 主题: Re: [dataabc/weibo-search] 小白求问,TypeError: expected string or bytes-like object 这是什么意思 (Issue #192) 我也遇到这个问题了,然后我把每个re.findall(r'\d+.',attitudes_count)都改成了re.findall(r'\d+.', str(attitudes_count))就解决了。 这是那个文件的代码? 前面的方法我都试过了 还是这样子 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
大佬厉害,我按照这个改成功了