有没有办法阻止解析从另一个页面重定向的响应?

Is there a way to prevent parsing responses that are redirected from another page?

我正在使用 CrawlSpider 抓取网站。一些请求匹配了带有回调的规则但被重定向到另一个页面,Scrapy 无论如何都会解析这些响应。有什么办法可以防止这种情况发生吗?

我自己没试过,但是 Requests.meta 对象似乎可以有一个 dont_redirect 属性,如果你设置它可能会解决你的问题。

http://doc.scrapy.org/en/latest/topics/downloader-middleware.html#std:reqmeta-dont_redirect