Dotnetspider (ii) Downloader settings request custom data dictionary

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.