开源爬虫的框架很多,不过对于使用者来说最最简单的应该是 NCrawler了。
该框架是基于C# 语言的。 依据其demo 代码,即使未学习过c# ,也可以在10分钟内生成属于自己的爬虫代码。
只需要将下面的uri替换为你需要的uri即可。
using (Crawler c = new Crawler(new Uri("http://blog.youkuaiyun.com/"),
new HtmlDocumentProcessor(), // Process html
//new iTextSharpPdfProcessor.iTextSharpPdfProcessor(), // Add PDF text extraction
// new GoogleLanguageDetection(), // Add language detection
//new Mp3FileProcessor(), // Add language detection
new DumperStep())
{
// Custom step to visualize crawl
MaximumThreadCount = 2,
MaximumCrawlDepth = 6,
//ExcludeFilter = Program.ExtensionsToSkip,
})
{
// Begin crawl
c.Crawl();
}