问答详情
源自:2-6 spider文件的编写(1)

我的为什么是这样子的。

2019-10-24 22:53:56 [scrapy] INFO: Scrapy 1.0.3 started (bot: douban)
2019-10-24 22:53:56 [scrapy] INFO: Optional features available: ssl, http11, boto
2019-10-24 22:53:56 [scrapy] INFO: Overridden settings: {'NEWSPIDER_MODULE': 'douban.spiders', 'SPIDER_MODULES': ['douban.spiders'], 'USER_AGENT': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0', 'DOWNLOAD_DELAY': 0.5, 'BOT_NAME': 'douban'}
2019-10-24 22:53:56 [scrapy] INFO: Enabled extensions: CloseSpider, TelnetConsole, LogStats, CoreStats, SpiderState
2019-10-24 22:53:56 [boto] DEBUG: Retrieving credentials from metadata server.
2019-10-24 22:53:57 [boto] ERROR: Caught exception reading instance data
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/boto/utils.py", line 210, in retry_url
    r = opener.open(req, timeout=timeout)
  File "/usr/lib/python2.7/urllib2.py", line 429, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 447, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1228, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1198, in do_open
    raise URLError(err)
URLError: <urlopen error timed out>
2019-10-24 22:53:57 [boto] ERROR: Unable to read instance data, giving up
2019-10-24 22:53:57 [scrapy] INFO: Enabled downloader middlewares: HttpAuthMiddleware, DownloadTimeoutMiddleware, UserAgentMiddleware, RetryMiddleware, DefaultHeadersMiddleware, MetaRefreshMiddleware, HttpCompressionMiddleware, RedirectMiddleware, CookiesMiddleware, ChunkedTransferMiddleware, DownloaderStats
2019-10-24 22:53:57 [scrapy] INFO: Enabled spider middlewares: HttpErrorMiddleware, OffsiteMiddleware, RefererMiddleware, UrlLengthMiddleware, DepthMiddleware
2019-10-24 22:53:57 [scrapy] INFO: Enabled item pipelines:
2019-10-24 22:53:57 [scrapy] INFO: Spider opened
2019-10-24 22:53:57 [scrapy] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min)
2019-10-24 22:53:57 [scrapy] DEBUG: Telnet console listening on 127.0.0.1:6023
2019-10-24 22:53:58 [scrapy] DEBUG: Crawled (200) <GET https://movie.douban.com/annual/2018?source=movie_navigation> (referer: None)
2019-10-24 22:53:58 [scrapy] ERROR: Spider error processing <GET https://movie.douban.com/annual/2018?source=movie_navigation> (referer: None)
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 588, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/home/ccd/douban/douban/spiders/douban_spider.py", line 16, in parse
    print(response.text)
AttributeError: 'HtmlResponse' object has no attribute 'text'
2019-10-24 22:53:58 [scrapy] INFO: Closing spider (finished)
2019-10-24 22:53:58 [scrapy] INFO: Dumping Scrapy stats:
{'downloader/request_bytes': 292,
 'downloader/request_count': 1,
 'downloader/request_method_count/GET': 1,
 'downloader/response_bytes': 1494,
 'downloader/response_count': 1,
 'downloader/response_status_count/200': 1,
 'finish_reason': 'finished',
 'finish_time': datetime.datetime(2019, 10, 24, 14, 53, 58, 212451),
 'log_count/DEBUG': 3,
 'log_count/ERROR': 3,
 'log_count/INFO': 7,
 'response_received_count': 1,
 'scheduler/dequeued': 1,
 'scheduler/dequeued/memory': 1,
 'scheduler/enqueued': 1,
 'scheduler/enqueued/memory': 1,
 'spider_exceptions/AttributeError': 1,
 'start_time': datetime.datetime(2019, 10, 24, 14, 53, 57, 797384)}
2019-10-24 22:53:58 [scrapy] INFO: Spider closed (finished)

提问者:qq_Iwanttobeabl_0 2019-10-24 23:12

个回答

  • 慕的地4323161
    2020-09-03 19:00:06

    你有解决么? 我的问题好像和你差不多