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

scrapy crawl douban_spider返回的好像有问题

scrapy crawl douban_spider返回的好像有问题,返回不正确

ubuntu@ubuntu:~/Project/douban/douban/spiders$ scrapy crawl douban_spider

:0: UserWarning: You do not have a working installation of the service_identity module: 'cannot import name 'opentype''.  Please install it from <https://pypi.python.org/pypi/service_identity> and make sure all of its dependencies are satisfied.  Without the service_identity module, Twisted can perform only rudimentary TLS client hostname verification.  Many valid certificate/hostname mappings may be rejected.

2019-03-05 14:14:25 [scrapy.utils.log] INFO: Scrapy 1.6.0 started (bot: douban)

2019-03-05 14:14:25 [scrapy.utils.log] INFO: Versions: lxml 3.5.0.0, libxml2 2.9.3, cssselect 1.0.3, parsel 1.5.1, w3lib 1.20.0, Twisted 18.9.0, Python 3.5.2 (default, Nov 12 2018, 13:43:14) - [GCC 5.4.0 20160609], pyOpenSSL 19.0.0 (OpenSSL 1.1.1b  26 Feb 2019), cryptography 2.6.1, Platform Linux-4.4.0-31-generic-x86_64-with-Ubuntu-16.04-xenial

2019-03-05 14:14:25 [scrapy.crawler] INFO: Overridden settings: {'SPIDER_MODULES': ['douban.spiders'], 'USER_AGENT': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36', 'NEWSPIDER_MODULE': 'douban.spiders', 'BOT_NAME': 'douban', 'ROBOTSTXT_OBEY': True}

2019-03-05 14:14:25 [scrapy.extensions.telnet] INFO: Telnet Password: 90e65d510e7e6763

2019-03-05 14:14:25 [scrapy.middleware] INFO: Enabled extensions:

['scrapy.extensions.corestats.CoreStats',

 'scrapy.extensions.memusage.MemoryUsage',

 'scrapy.extensions.telnet.TelnetConsole',

 'scrapy.extensions.logstats.LogStats']

2019-03-05 14:14:25 [scrapy.middleware] INFO: Enabled downloader middlewares:

['scrapy.downloadermiddlewares.robotstxt.RobotsTxtMiddleware',

 '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']

2019-03-05 14:14:25 [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']

2019-03-05 14:14:25 [scrapy.middleware] INFO: Enabled item pipelines:

[]

2019-03-05 14:14:25 [scrapy.core.engine] INFO: Spider opened

2019-03-05 14:14:25 [scrapy.extensions.logstats] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min)

2019-03-05 14:14:25 [scrapy.extensions.telnet] INFO: Telnet console listening on 127.0.0.1:6023

2019-03-05 14:14:26 [scrapy.core.downloader.tls] WARNING: Remote certificate is not valid for hostname "movie.douban.com"; '*.douban.com'!='movie.douban.com'

2019-03-05 14:14:26 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://movie.douban.com/robots.txt> (referer: None)

2019-03-05 14:14:26 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://movie.douban.com/top250> (referer: None)

False

2019-03-05 14:14:26 [scrapy.core.engine] INFO: Closing spider (finished)

2019-03-05 14:14:26 [scrapy.statscollectors] INFO: Dumping Scrapy stats:

{'downloader/request_bytes': 598,

 'downloader/request_count': 2,

 'downloader/request_method_count/GET': 2,

 'downloader/response_bytes': 13446,

 'downloader/response_count': 2,

 'downloader/response_status_count/200': 2,

 'finish_reason': 'finished',

 'finish_time': datetime.datetime(2019, 3, 5, 6, 14, 26, 313937),

 'log_count/DEBUG': 2,

 'log_count/INFO': 9,

 'log_count/WARNING': 1,

 'memusage/max': 51126272,

 'memusage/startup': 51126272,

 'response_received_count': 2,

 'robotstxt/request_count': 1,

 'robotstxt/response_count': 1,

 'robotstxt/response_status_count/200': 1,

 'scheduler/dequeued': 1,

 'scheduler/dequeued/memory': 1,

 'scheduler/enqueued': 1,

 'scheduler/enqueued/memory': 1,

 'start_time': datetime.datetime(2019, 3, 5, 6, 14, 25, 662253)}

2019-03-05 14:14:26 [scrapy.core.engine] INFO: Spider closed (finished)


提问者:MmILYToo 2019-03-05 14:16

个回答

  • 攻城狮小关
    2020-08-19 15:26:22

    这个需要改一下user_agent