Closed PhoebusSi closed 4 years ago
感谢反馈。
应该是被限制了,限制一段时间会自动解除,可以通过降低速度解决,具体修改weibo_spider.py文件的get_weibo_info方法,原来的代码:
if (page - page1) % random_pages == 0 and page < page_num:
sleep(random.randint(6, 10))
page1 = page
random_pages = random.randint(1, 5)
上面是每1到5页随机等待6-10秒,你可以加快暂停频率(减小random_pages)或加大等待时间(加大sleep)解决。
如果还有问题,欢迎继续讨论
谢谢 我在另一个issue中找到了这个原因。感谢感谢
信息科学学院佀庆一 | |
---|---|
邮箱:xk17sqy@126.com |
签名由 网易邮箱大师 定制
在2020年06月13日 19:38,Chen Lei 写道:
感谢反馈。
应该是被限制了,限制一段时间会自动解除,可以通过降低速度解决,具体修改weibo_spider.py文件的get_weibo_info方法,原来的代码:
if (page - page1) % random_pages == 0 and page < page_num:
sleep(random.randint(6, 10))
page1 = page
random_pages = random.randint(1, 5)
上面是每1到5页随机等待6-10秒,你可以加快暂停频率(减小random_pages)或加大等待时间(加大sleep)解决。
如果还有问题,欢迎继续讨论
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Closing as stale, please reopen if you'd like to work on this further.
为了更好的解决问题,请认真回答下面的问题。等到问题解决,请及时关闭本issue。
问:请您指明哪个版本运行出错(github版/PyPi版/全部)?
答:GitHub
问:您使用的是否是最新的程序(是/否)?
答:是
问:爬取任意用户都会运行出错吗(是/否)?
答:否
问:若只有爬特定微博时才出错,能否提供出错微博的weibo_id或url(非必填)?
答:偶尔报错,停下程序,甚至有时候这个报错导致启动不了程序,一运行就这个报错
问:若您已提供出错微博的weibo_id或url,可忽略此内容,否则能否提供出错账号的user_id(非必填)?
答:
问:如果方便,请您描述出错详情,最好附上错误提示。
答:Traceback (most recent call last): File "/home/erqing/weiboSpider/weibo_spider/weibo_spider.py", line 195, in start printer.print_user_info(self.user) File "/home/erqing/weiboSpider/weibo_spider/printer.py", line 19, in print_user_info print(u"用户昵称: %s" % user["nickname"]) TypeError: 'NoneType' object is not subscriptable。