问题
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