实例介绍
NCrawler是一款简单而高效的基于.NET的多线程网页爬虫,采用基于管道的处理方式编写,使用C#开发。它包含了HTML、文本、PDF以及IFilter文档处理器,并集成了语言检测功能(Google)。通过添加管道步骤,用户可以轻松地提取、使用和修改信息。
NCrawler是2010年NCrawler的全新重写版本,采用了更现代的编程方法。目前已更新至v4版本。
// 示例代码:初始化NCrawler
var crawler = new NCrawler();
// 配置爬虫参数
// 开始爬取网页
NCrawler不仅易于使用,还支持高度自定义,适合需要进行网页数据抓取的开发者。【实例截图】
【核心代码】
文件清单
└── NCrawler-ee3e2af901adbcf452378ece673ffde3bb399496
├── LICENSE
├── README.md
└── src
├── build.bat
├── build.cake
├── build.ps1
├── NCrawler
│ ├── CrawlerConfiguration.cs
│ ├── CrawlerConfiguration.Run.Cs
│ ├── CrawlStep.cs
│ ├── Extensions
│ │ ├── AspectExtensions.cs
│ │ ├── IEnumerableExtensions.cs
│ │ ├── ObjectExtensions.cs
│ │ ├── StringExtensions.cs
│ │ ├── UriExtensions.cs
│ │ └── UrlExtensions.cs
│ ├── ICrawler.cs
│ ├── IPipelineStep.cs
│ ├── NCrawler.csproj
│ ├── packages.config
│ ├── Pipeline
│ │ ├── DefaultDownloadPipelineStep.cs
│ │ ├── EMailEntityExtractionProcessor.cs
│ │ ├── LambdaFilterPipelineStep.cs
│ │ └── LinkExtractionPipelineStep.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── SharedAssemblyInfo.cs
│ ├── PropertyBag.cs
│ └── Utils
│ ├── AspectF.cs
│ ├── DisposableBase.cs
│ └── TempFile.cs
├── NCrawler.Console
│ ├── app.config
│ ├── Extensions
│ │ └── AspectExtensions.cs
│ ├── NConsoler.cs
│ ├── NCrawler.Console.csproj
│ ├── Program.cs
│ └── Properties
│ └── AssemblyInfo.cs
├── NCrawler.Flurl
│ ├── app.config
│ ├── CrawlerConfigurationExtensions.cs
│ ├── FlurlDownloadPipelineStep.cs
│ ├── NCrawler.Flurl.csproj
│ ├── packages.config
│ └── Properties
│ └── AssemblyInfo.cs
├── NCrawler.Flurl.Tests
│ ├── app.config
│ ├── Content
│ │ └── NCrawler - Home.html
│ ├── FlurlDownloadPipelineStepTests.cs
│ ├── NCrawler.Flurl.Tests.csproj
│ ├── packages.config
│ └── Properties
│ └── AssemblyInfo.cs
├── NCrawler.HtmlProcessor
│ ├── ContentCrawlerRules.cs
│ ├── CrawlerConfigurationExtensions.cs
│ ├── Extensions
│ │ ├── ExtendedHtmlUtility.cs
│ │ └── HtmlAgilityPackExtensions.cs
│ ├── HtmlDocumentProcessorPipelineStep.cs
│ ├── Interfaces
│ │ └── ISubstitution.cs
│ ├── NCrawler.HtmlProcessor.csproj
│ ├── packages.config
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── RegexSubstitution.cs
│ └── TextDocumentProcessorPipelineStep.cs
├── NCrawler.HtmlProcessor.Tests
│ ├── Content
│ │ ├── NCrawler - Home.html
│ │ └── NCrawler - Home.txt
│ ├── HtmlDocumentProcessorPipelineStepTests.cs
│ ├── NCrawler.HtmlProcessor.Tests.csproj
│ ├── packages.config
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── TextDocumentProcessorPipelineStepTests.cs
├── NCrawler.LanguageDetection.Google
│ ├── app.config
│ ├── Core14.profile.xml
│ ├── CrawlerConfigurationExtensions.cs
│ ├── GoogleLanguageDetection.cs
│ ├── NCrawler.LanguageDetection.Google.csproj
│ ├── packages.config
│ └── Properties
│ └── AssemblyInfo.cs
├── NCrawler.LanguageDetection.Google.Tests
│ ├── app.config
│ ├── Content
│ │ └── NCrawler - Home.txt
│ ├── GoogleLanguageDetectionTests.cs
│ ├── NCrawler.LanguageDetection.Google.Tests.csproj
│ ├── packages.config
│ └── Properties
│ └── AssemblyInfo.cs
├── NCrawler.PDFBox
│ ├── App.config
│ ├── CrawlerConfigurationExtensions.cs
│ ├── NCrawler.PDFBox.csproj
│ ├── PdfBoxTextExtractorProcessorPipelineStep.cs
│ └── Properties
│ └── AssemblyInfo.cs
├── NCrawler.PDFBox.Tests
│ ├── NCrawler.PDFBox.Tests.csproj
│ ├── packages.config
│ ├── PdfBoxTextExtractorProcessorPipelineStepTests.cs
│ └── Properties
│ └── AssemblyInfo.cs
├── NCrawler.proj
├── NCrawler.Robots
│ ├── NCrawler.Robots.csproj
│ ├── packages.config
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── RobotsCrawlerConfigurationExtensions.cs
│ └── RobotsPipelineStep.cs
├── NCrawler.Robots.Tests
│ ├── Content
│ │ └── Robots.txt
│ ├── NCrawler.Robots.Tests.csproj
│ ├── packages.config
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── RobotsPipelineStepTests.cs
├── NCrawler.SitemapProcessor
│ ├── CrawlerConfigurationExtensions.cs
│ ├── NCrawler.SitemapProcessor.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── SitemapProcessor.cs
├── NCrawler.SitemapProcessor.Tests
│ ├── NCrawler.SitemapProcessor.Tests.csproj
│ ├── packages.config
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── SitemapProcessorTests.cs
├── NCrawler.sln
├── NCrawler.Toxy
│ ├── app.config
│ ├── CrawlerConfigurationExtensions.cs
│ ├── NCrawler.Toxy.csproj
│ ├── packages.config
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── ToxyTextExtractorProcessorPipelineStep.cs
├── NCrawler.Toxy.Tests
│ ├── App.config
│ ├── Content
│ │ ├── Georgia_opposition_NATO-Eng-F.doc
│ │ └── SampleData.xls
│ ├── NCrawler.Toxy.Tests.csproj
│ ├── packages.config
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── ToxyTextExtractorProcessorPipelineStepTests.cs
├── NCrawler.WebServer
│ ├── NCrawler.WebServer.csproj
│ ├── packages.config
│ ├── PortUtils.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── SimpleWebServer.cs
└── tools
├── Cake
│ ├── Autofac.dll
│ ├── Cake.Common.dll
│ ├── Cake.Common.xml
│ ├── Cake.Core.dll
│ ├── Cake.Core.xml
│ ├── Cake.exe
│ ├── Cake.NuGet.dll
│ ├── Cake.NuGet.xml
│ ├── Mono.CSharp.dll
│ ├── NuGet.Core.dll
│ ├── Roslyn.Compilers.CSharp.dll
│ └── Roslyn.Compilers.dll
├── nuget.exe
├── NUnit.ConsoleRunner
│ ├── CHANGES.txt
│ ├── LICENSE.txt
│ ├── NOTICES.txt
│ └── tools
│ ├── Mono.Cecil.dll
│ ├── nunit3-console.exe
│ ├── nunit3-console.exe.config
│ ├── nunit-agent.exe
│ ├── nunit-agent.exe.config
│ ├── nunit-agent-x86.exe
│ ├── nunit-agent-x86.exe.config
│ ├── nunit.engine.api.dll
│ ├── nunit.engine.api.xml
│ ├── nunit.engine.dll
│ └── nunit.nuget.addins
├── packages.config
└── PDFBox.NET-1.8.9
└── license
├── ikvm
│ ├── LICENSE
│ ├── THIRD_PARTY_README
│ └── TRADEMARK
└── pdfbox
├── LICENSE.txt
└── NOTICE.txt
55 directories, 157 files
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论