刮 Walmart.com 并使用刮擦获得"Error Page Could not connect to server"



我刚开始报废,已经报废了一些网站(如亚马逊、百思买(,并取得了成功。我一直在努力打开www.walmart.com。

$ scrapy shell "www.walmart.com"
2018-08-01 13:47:18 [scrapy.utils.log] INFO: Scrapy 1.5.0 started (bot: scrapybot)
2018-08-01 13:47:18 [scrapy.utils.log] INFO: Versions: lxml 4.2.1.0, libxml2 2.9.8, cssselect 1.0.3, parsel 1.4.0, w3lib 1.19.0, Twisted 18.4.0, Python 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28) - [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)], pyOpenSSL 18.0.0 (OpenSSL 1.1.0h  27 Mar 2018), cryptography 2.2.2, Platform Darwin-17.7.0-x86_64-i386-64bit
2018-08-01 13:47:18 [scrapy.crawler] INFO: Overridden settings: {'DUPEFILTER_CLASS': 'scrapy.dupefilters.BaseDupeFilter', 'LOGSTATS_INTERVAL': 0}
2018-08-01 13:47:18 [scrapy.middleware] INFO: Enabled extensions:
['scrapy.extensions.corestats.CoreStats',
'scrapy.extensions.telnet.TelnetConsole',
'scrapy.extensions.memusage.MemoryUsage']
2018-08-01 13:47:18 [scrapy.middleware] INFO: Enabled downloader middlewares:
['scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware',
'scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware',
'scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware',
'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware',
'scrapy.downloadermiddlewares.retry.RetryMiddleware',
'scrapy.downloadermiddlewares.redirect.MetaRefreshMiddleware',
'scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware',
'scrapy.downloadermiddlewares.redirect.RedirectMiddleware',
'scrapy.downloadermiddlewares.cookies.CookiesMiddleware',
'scrapy.downloadermiddlewares.httpproxy.HttpProxyMiddleware',
'scrapy.downloadermiddlewares.stats.DownloaderStats']
2018-08-01 13:47:18 [scrapy.middleware] INFO: Enabled spider middlewares:
['scrapy.spidermiddlewares.httperror.HttpErrorMiddleware',
'scrapy.spidermiddlewares.offsite.OffsiteMiddleware',
'scrapy.spidermiddlewares.referer.RefererMiddleware',
'scrapy.spidermiddlewares.urllength.UrlLengthMiddleware',
'scrapy.spidermiddlewares.depth.DepthMiddleware']
2018-08-01 13:47:18 [scrapy.middleware] INFO: Enabled item pipelines:
[]
2018-08-01 13:47:18 [scrapy.extensions.telnet] DEBUG: Telnet console listening on 127.0.0.1:6024
2018-08-01 13:47:18 [scrapy.core.engine] INFO: Spider opened
2018-08-01 13:47:20 [scrapy.core.engine] DEBUG: Crawled (200) <GET http://www.walmart.com> (referer: None)
[s] Available Scrapy objects:
[s]   scrapy     scrapy module (contains scrapy.Request, scrapy.Selector, etc)
[s]   crawler    <scrapy.crawler.Crawler object at 0x10d4943c8>
[s]   item       {}
[s]   request    <GET http://www.walmart.com>
[s]   response   <200 http://www.walmart.com>
[s]   settings   <scrapy.settings.Settings object at 0x10e6f15f8>
[s]   spider     <DefaultSpider 'default' at 0x10e9af2b0>
[s] Useful shortcuts:
[s]   fetch(url[, redirect=True]) Fetch URL and update local objects (by default, redirects are followed)
[s]   fetch(req)                  Fetch a scrapy.Request and update local objects 
[s]   shelp()           Shell help (print this help)
[s]   view(response)    View response in a browser
>>> view(response)
True

我得到了一个响应代码(200(,这应该意味着它成功地爬网了,但当我查看(响应(时,我得到了显示的网页

"错误页面

无法连接到服务器">

我尝试更改我的IP,使用VPN,使用不同的互联网连接,并在互联网上搜索答案,但找不到。

我犯了什么错误?我该怎么过去?任何形式的帮助都将不胜感激。

您需要设置一个"真正的"用户代理。类似的东西

$ scrapy shell -s USER_AGENT='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36' www.walmart.com

相关内容

最新更新