scrapy shell 跳转到另外的页面了

来源:7-4 Rule和LinkExtractor使用

Amo_u

2018-08-06

输入的是 http://www.jwc.shu.edu.cn/Default.aspx?tabid=23168&ctl=Detail&mid=43516&Id=231393

但是却get到的是 http://www.jwc.shu.edu.cn/Default.aspx?tabid=23168

log里也没有写转向标志

E:\Amo\SHUSpider>scrapy shell http://www.jwc.shu.edu.cn/Default.aspx?tabid=23168&ctl=Detail&mid=43516&Id=231393
2018-08-06 17:25:24 [scrapy.utils.log] INFO: Scrapy 1.5.0 started (bot: SHUSpider)
2018-08-06 17:25:24 [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 17.5.0, Python 3.6.5 |Anaconda custom (64-bit)| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)],
 pyOpenSSL 18.0.0 (OpenSSL 1.0.2o  27 Mar 2018), cryptography 2.2.2, Platform Windows-10-10.0.16299-SP0
2018-08-06 17:25:24 [scrapy.crawler] INFO: Overridden settings: {'BOT_NAME': 'SHUSpider', 'DUPEFILTER_CLASS': 'scrapy.dupef
ilters.BaseDupeFilter', 'LOGSTATS_INTERVAL': 0, 'NEWSPIDER_MODULE': 'SHUSpider.spiders', 'SPIDER_MODULES': ['SHUSpider.spid
ers']}
2018-08-06 17:25:24 [scrapy.middleware] INFO: Enabled extensions:
['scrapy.extensions.corestats.CoreStats',
 'scrapy.extensions.telnet.TelnetConsole']
2018-08-06 17:25:24 [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-06 17:25:24 [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-06 17:25:24 [scrapy.middleware] INFO: Enabled item pipelines:
['SHUSpider.pipelines.ShuspiderPipeline',
 'SHUSpider.pipelines.MysqlTwistedPipeline']
2018-08-06 17:25:24 [scrapy.extensions.telnet] DEBUG: Telnet console listening on 127.0.0.1:6023
2018-08-06 17:25:24 [scrapy.core.engine] INFO: Spider opened
2018-08-06 17:25:25 [scrapy.core.engine] DEBUG: Crawled (200) <GET http://www.jwc.shu.edu.cn/Default.aspx?tabid=23168> (ref
erer: None)
[s] Available Scrapy objects:
[s]   scrapy     scrapy module (contains scrapy.Request, scrapy.Selector, etc)
[s]   crawler    <scrapy.crawler.Crawler object at 0x0000021A3460AC18>
[s]   item       {}
[s]   request    <GET http://www.jwc.shu.edu.cn/Default.aspx?tabid=23168>
[s]   response   <200 http://www.jwc.shu.edu.cn/Default.aspx?tabid=23168>
[s]   settings   <scrapy.settings.Settings object at 0x0000021A36DB0898>
[s]   spider     <JwcSpider 'jwc' at 0x21a37139470>



写回答

1回答

Amo_u

提问者

2018-08-08

已解决 是被重定向了 感觉没认真听课 明明老师有讲设置redirect

=。=

在scrapy shell中用fetch 再设置redirect=False就好啦


0
2
bobby
好的,
2018-08-08
共2条回复

Scrapy打造搜索引擎 畅销4年的Python分布式爬虫课

带你彻底掌握Scrapy,用Django+Elasticsearch搭建搜索引擎

5796 学习 · 6290 问题

查看课程