Unable to access request.response.meta['redirect_urls'] from Scrapy script

混江龙づ霸主 提交于 2019-12-07 14:42:44

问题


I am unable to access request.response.meta['redirect_urls'] from my Scrapy script, but have no problem accessing this information for the same webpage in the Scrapy shell. When I print the keys of request.response.meta I only see download_timeout, depth, download_latency, download_slot

I am wondering if this is to do with one of the settings I have modified in my Scrapy script which contains the following:

settings.set('DEPTH_LIMIT', 4)
settings.set('DOWNLOAD_DELAY', 1)
settings.set('USER_AGENT', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko)')
settings.set('SPLASH_URL', 'http://192.168.59.103:8050')
settings.set('DOWNLOADER_MIDDLEWARES', {'scrapyjs.SplashMiddleware': 725})
settings.set('DUPEFILTER_CLASS', 'scrapyjs.SplashAwareDupeFilter')
settings.set('HTTPCACHE_STORAGE', 'scrapyjs.SplashAwareFSCacheStorage')

I know redirection is also handled by middlewares so is this an issue because I am using SplashMiddleware and is it possible to use both? I know the redirection is happening from looking at response.url

Many thanks

来源:https://stackoverflow.com/questions/36618597/unable-to-access-request-response-metaredirect-urls-from-scrapy-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!