This article mainly shares the custom downloader and request information, implements the custom request content, and stores the custom content.
* * Warm tip: If you want to reprint this article, please indicate the source of the content. **
This article connects: http://www.cnblogs.com/grom/p/8968905.html
Next, in the original project based on the transformation, for the Entityspider set downloader.
Custom Downloader class:
public class AtzucheDownloader:DotnetSpider.Core.Downloader.BaseDownloader
{
protected override Page Dowloadcontent (Request request, Ispider Spider)
{
var site = Spider. Site;
Request. Extras = new dictionary<string, dynamic> ();
Request. Extras.add ("Date", DateTime.Now.ToString ("Yyyy-mm-dd"));
Page page = new page (request);
return new DotnetSpider.Core.Downloader.HttpClientDownloader (). Download (Request,spider);
}
}
Comments are:
The data dictionary here can be used in the selector using Selectortype.enviroment.
, the URL for request comes with Key,date is the property we set above, through this method, to insert a column of custom data within the database, I am here to record the fetch date.
Results:
This time the share is here, thank you ...
Dotnetspider (ii) Downloader settings request custom data dictionary