【问题标题】:Scrapy Twisted ConnectionLost errorScrapy Twisted ConnectionLost 错误
【发布时间】:2018-05-04 06:19:46
【问题描述】:

我正在学习scrapy,并且很难弄清楚这个问题。我的蜘蛛爬不上梅西的网站,一直报如下错误:

[<twisted.python.failure.Failure twisted.internet.error.ConnectionLost: Connection to the other side was lost in a non-clean fashion: Connection lost.>]

到目前为止我尝试过的事情:

  1. 设置标题和 robotstxt 遵守此线程: Scrapy Shell: twisted.internet.error.ConnectionLost although USER_AGENT is set
  2. 按此线程更改用户代理: How to prevent a twisted.internet.error.ConnectionLost error when using Scrapy?
  3. 密码学 Scrapy twisted connection lost in non-clean fashion. No proxy. Already tried headers
  4. 猴子补丁: Twisted Python Failure - Scrapy Issues

我还在命令提示符中检查了scrapy shell“www.macys.com”并得到了同样的错误。所以我猜问题不在于我的蜘蛛。有人可以帮忙吗?

【问题讨论】:

  • 您还能在导航器中访问该网站吗?

标签: python scrapy twisted


【解决方案1】:

您的 IP 似乎正在启动您的爬虫已被列入黑名单。

您可能想阅读以下内容:https://doc.scrapy.org/en/latest/topics/practices.html#avoiding-getting-banned

此外,您可能需要调整 the settings 与 scrapy 输出的请求数有关:CONCURRENT_REQUESTSDOWNLOAD_DELAY 等。

【讨论】:

  • 我注释掉了我的 USER_AGENT 并且脚本有效。知道为什么吗? USER_AGENT = 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36'
  • 可能是 TCP 指纹识别?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-05-24
相关资源
最近更新 更多