This method is called for each request that goes through the download middleware.
process_request() should either: return None, return a Response object, return a Request object, or raise IgnoreRequest.
…
If it returns a Response object, Scrapy won’t bother calling any other process_request() or process_exception() methods, or the appropriate download function; it’ll return that response.
你想写的是downloader middleware component。你问它是否有可能“改变请求处理”;它的介绍说它是一个“全球改变Scrapy的请求和响应的系统”;我不知道为什么你不会认为这是你要找的,但如果你继续读下去,这正是它听起来的样子。你知道吗
DownloaderMiddleware
对象中的关键方法是process_request
。正如医生所说:所以,您只需编写一个
DownloaderMiddleware
,它的process_request
调用Selenium,处理它返回的内容,并将其包装在Response
中返回。你知道吗如果不明显,内置的
HttpCacheMiddleware
应该演示如何做到这一点。你知道吗您不必更改请求,只需在spider中执行Selenium即可。你知道吗
但根据我的经验,只有极少数的事情你不能单独用scrapy来做。 你有一个链接显示什么样的东西,你正在寻找?你知道吗
相关问题 更多 >
编程相关推荐