- Downloader middleware: You can customize the middleware and the medium price priority;
I. How to add downloader middleware? RewriteProcess_request,Process_response,Process_exceptionFunction;
Ii. Why downloader middleware? Rewrite the request or specify the download behavior. For example, whether to send a cookie, specify the cache mechanism, Retry Mechanism, and how to process the redirected data.
Iii. What are the built-in downloader middleware? About 13
- Cookiesmiddleware: Whether to forwardWeb ServerSendCookie
- Defaultheadersmiddleware: Set allRequestSet the header to the default mode.
- Downloadtimeoutmiddleware: SetRequestOfTimeout
- Httpauthmiddleware:SpiderOfRequestAuthorization
- Httpcachemiddleware:Request & ResponseSet cache policies
- Httpcompressionmiddleware:
- Chunkedtransfermiddleware:
- Httpproxymiddleware: To allRequestSetHTTPProxy
- Redirectmiddleware: ProcessingRequestRedirection
- Metarefreshmiddleware: AccordingMeta-Refresh HTML Tag processing redirection
- Retrymiddleware: Retry upon failure Policy
- Robotstxtmiddleware:Robots bans
- Useragentmiddleware: SupportedUser AgentRewrite
B)SpiderMiddleware: Customizable middleware and priority;
IV.How to add a newSpiderMiddleware? Heavy LoadProcess_spider_input,Process_spider_output,Process_spider_exception,Process_start_requests
V.Built-inSpiderWhat are middleware Products? About5Type
- Depthmiddleware: Sets the priority of capture depth and depth;
- Httperrormiddleware: Set the range of successful Codes
- Offsitemiddleware: Primary domain filtering
- Referermiddleware:
- Urllengthmiddleware: VALIDURLLength