实例介绍
DotnetSpider是一个.NET标准的网络爬虫库。它是一个轻量级、高效、快速的高级网络爬虫和数据抓取框架。
开发环境
- Visual Studio 2017(15.3或更高版本)或Jetbrains Rider
- .NET Core 2.2或更高版本
- Docker
- MySql
docker run --name mysql -d -p 3306:3306 --restart always -e MYSQL_ROOT_PASSWORD=1qazZAQ! mysql:5.7
docker run --name redis -d -p 6379:6379 --restart always redis
docker run --name sqlserver -d -p 1433:1433 --restart always -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=1qazZAQ!' mcr.microsoft.com/mssql/server:2017-latest
docker run --name postgres -d -p 5432:5432 --restart always -e POSTGRES_PASSWORD=1qazZAQ! postgres
docker run --name mongo -d -p 27017:27017 --restart always m
【实例截图】
【核心代码】
文件清单
└── DotnetSpider-f01fd36c4c8ed5b91e18908d6cc14b68111661cd
├── azure-pipelines.yml
├── build_agent.sh
├── build_portal.sh
├── build.sh
├── build_spiders.sh
├── Directory.Build.props
├── docker-compose
│ ├── agent1.json
│ ├── agent2.json
│ ├── agent.yml
│ ├── hbase.yml
│ ├── portal.yml
│ ├── rabbitmq.yml
│ └── reset_agent.sh
├── dockerfile
│ ├── agent
│ │ └── Dockerfile
│ ├── portal
│ │ └── Dockerfile
│ └── spiders
│ └── Dockerfile
├── DotnetSpider.sln
├── images
│ ├── icon.ico
│ ├── icon.png
│ └── 数据采集系统.png
├── LICENSE.txt
├── package.props
├── publish_agent.sh
├── publish_myget.sh
├── publish_nuget.sh
├── publish_package.sh
├── publish_portal.sh
├── publish.sh
├── publish_spiders.sh
├── publish_startup.sh
├── README.md
├── runtests.sh
└── src
├── DotnetSpider
│ ├── Agent
│ │ ├── AgentOptions.cs
│ │ ├── AgentService.cs
│ │ └── ServiceCollectionExtensions.cs
│ ├── AgentCenter
│ │ ├── AgentCenterOptions.cs
│ │ ├── AgentCenterService.cs
│ │ ├── ServiceCollectionExtensions.cs
│ │ └── Store
│ │ ├── AgentHeartbeat.cs
│ │ ├── AgentInfo.cs
│ │ ├── IAgentStore.cs
│ │ └── InMemoryAgentStore.cs
│ ├── Builder.cs
│ ├── DataFlow
│ │ ├── DataFlowBase.cs
│ │ ├── DataFlowContext.cs
│ │ ├── IDataFlow.cs
│ │ ├── Parser
│ │ │ ├── DataParser.cs
│ │ │ ├── DataParser`.cs
│ │ │ ├── EntitySelector.cs
│ │ │ ├── FollowRequestSelector.cs
│ │ │ ├── Formatter.cs
│ │ │ ├── Formatters
│ │ │ │ ├── CharacterCaseFormatter.cs
│ │ │ │ ├── CutoutFormatter.cs
│ │ │ │ ├── DigitUnitFormatter.cs
│ │ │ │ ├── DisplaceFormatter.cs
│ │ │ │ ├── Download.cs
│ │ │ │ ├── HtmlDecodeFormatter.cs
│ │ │ │ ├── RegexAppendFormatter.cs
│ │ │ │ ├── RegexFormatter.cs
│ │ │ │ ├── RegexReplaceFormatter.cs
│ │ │ │ ├── ReplaceFormatter.cs
│ │ │ │ ├── SplitFormatter.cs
│ │ │ │ ├── StringFormatter.cs
│ │ │ │ ├── TimeStampFormater.cs
│ │ │ │ ├── TrimFormatter.cs
│ │ │ │ ├── UrlDecodeFormatter.cs
│ │ │ │ └── UrlEncodeFormatter.cs
│ │ │ ├── GlobalValueSelector.cs
│ │ │ ├── Model.cs
│ │ │ ├── Selector.cs
│ │ │ ├── SelectorExtensions.cs
│ │ │ └── ValueSelector.cs
│ │ └── Storage
│ │ ├── Column.cs
│ │ ├── ConsoleEntityStorage.cs
│ │ ├── ConsoleStorage.cs
│ │ ├── EntityBase.cs
│ │ ├── EntityFileStorageBase.cs
│ │ ├── EntityStorageBase.cs
│ │ ├── FileStorageBase.cs
│ │ ├── FileStorage.cs
│ │ ├── ImageStorage.cs
│ │ ├── IndexMetadata.cs
│ │ ├── JsonEntityFileStorage.cs
│ │ ├── JsonFileStorage.cs
│ │ ├── RelationalDatabaseEntityStorageBase.cs
│ │ ├── Schema.cs
│ │ ├── SqlServerEntityStorage.cs
│ │ ├── SqlStatements.cs
│ │ ├── StorageMode.cs
│ │ ├── StorageUtilities.cs
│ │ ├── TableMetadata.cs
│ │ └── TablePostfix.cs
│ ├── DependenceServices.cs
│ ├── DotnetSpider.csproj
│ ├── Downloader
│ │ ├── Downloaders.cs
│ │ ├── EmptyDownloader.cs
│ │ ├── FakeHttpClientDownloader.cs
│ │ ├── FileDownloader.cs
│ │ ├── HttpClientDownloader.cs
│ │ ├── IDownloader.cs
│ │ ├── IProxyDownloader.cs
│ │ ├── PPPoEHttpClientDownloader.cs
│ │ ├── PPPoEOptions.cs
│ │ ├── PPPoEService.cs
│ │ ├── PuppeteerDownloader.cs
│ │ └── ServiceCollectionExtensions.cs
│ ├── ExitException.cs
│ ├── Extensions
│ │ ├── EnumerableExtensions.cs
│ │ ├── HttpStatusCodeExtensions.cs
│ │ ├── MessageExtensions.cs
│ │ ├── MessagePackSerializerExtensions.cs
│ │ └── MessageQueueExtensions.cs
│ ├── HtmlAgilityPack.Css
│ │ ├── Either.cs
│ │ ├── ExtensionMethods.cs
│ │ ├── HtmlNodeExtensions.cs
│ │ ├── HtmlNodeOps.cs
│ │ ├── HtmlNodeSelection.cs
│ │ ├── IElementOps.cs
│ │ ├── ISelectorGenerator.cs
│ │ ├── LRUCache.cs
│ │ ├── NamespacePrefix.cs
│ │ ├── Parser.cs
│ │ ├── Reader.cs
│ │ ├── Selector.cs
│ │ ├── SelectorGenerator.cs
│ │ ├── Token.cs
│ │ ├── Tokener.cs
│ │ └── TokenKind.cs
│ ├── Http
│ │ ├── ByteArrayContent.cs
│ │ ├── ContentHeaders.cs
│ │ ├── HeaderNames.cs
│ │ ├── HeaderUtilities.cs
│ │ ├── HttpResponseMessageExtensions.cs
│ │ ├── IHttpContent.cs
│ │ ├── Request.cs
│ │ ├── RequestHeaders.cs
│ │ ├── RequestPolicy.cs
│ │ ├── Response.cs
│ │ ├── ResponseHeaders.cs
│ │ └── StringContent.cs
│ ├── Infrastructure
│ │ ├── BloomFilter.cs
│ │ ├── Check.cs
│ │ ├── Consts.cs
│ │ ├── DateTimeHelper.cs
│ │ ├── DefaultHttpMessageHandlerBuilder.cs
│ │ ├── DockerLifeTime.cs
│ │ ├── HashAlgorithmService.cs
│ │ ├── HtmlUtilities.cs
│ │ ├── IHashAlgorithmService.cs
│ │ ├── IRequestHasher.cs
│ │ ├── MachineInfo.cs
│ │ ├── MD5HashAlgorithmService.cs
│ │ ├── MurmurHashAlgorithmService.cs
│ │ ├── MySqlFileType.cs
│ │ ├── ObjectId.cs
│ │ ├── ObjectUtilities.cs
│ │ ├── PagedResult.cs
│ │ ├── ParallelUtilities.cs
│ │ ├── PrintArgumentService.cs
│ │ ├── RequestedQueue.cs
│ │ ├── RequestHasher.cs
│ │ ├── SpiderId.cs
│ │ └── UriUtilities.cs
│ ├── MessageQueue
│ │ ├── AsyncMessageConsumer.cs
│ │ ├── AsyncMessageHandler.cs
│ │ ├── IMessageQueue.cs
│ │ ├── Message.cs
│ │ ├── MessageQueue.cs
│ │ ├── Messages.cs
│ │ ├── ServiceCollectionExtensions.cs
│ │ └── Topics.cs
│ ├── Proxy
│ │ ├── DefaultProxyValidator.cs
│ │ ├── EmptyProxyService.cs
│ │ ├── EmptyProxySupplier.cs
│ │ ├── FakeProxyValidator.cs
│ │ ├── FiddlerProxySupplier.cs
│ │ ├── IProxyService.cs
│ │ ├── IProxySupplier.cs
│ │ ├── IProxyValidator.cs
│ │ ├── KuaidailiProxySupplier.cs
│ │ ├── ProxyBackgroundService.cs
│ │ ├── ProxyHttpClientHandler.cs
│ │ ├── ProxyHttpMessageHandlerBuilder.cs
│ │ ├── ProxyOptions.cs
│ │ ├── ProxyService.cs
│ │ └── ServiceCollectionExtensions.cs
│ ├── RequestSupplier
│ │ └── IRequestSupplier.cs
│ ├── Scheduler
│ │ ├── Component
│ │ │ ├── BloomFilterDuplicateRemover.cs
│ │ │ ├── BloomFilterOptions.cs
│ │ │ ├── FakeDuplicateRemover.cs
│ │ │ ├── HashSetDuplicateRemover.cs
│ │ │ └── IDuplicateRemover.cs
│ │ ├── IScheduler.cs
│ │ ├── QueueBfsScheduler.cs
│ │ ├── QueueDfsScheduler.cs
│ │ ├── QueueDistinctBfsScheduler.cs
│ │ ├── QueueDistinctDfsScheduler.cs
│ │ ├── SchedulerBase.cs
│ │ └── ServiceCollectionExtensions.cs
│ ├── Selector
│ │ ├── CssSelector.cs
│ │ ├── HtmlSelectable.cs
│ │ ├── ISelectable.cs
│ │ ├── ISelector.cs
│ │ ├── JsonPathSelector.cs
│ │ ├── JsonSelectable.cs
│ │ ├── RegexSelector.cs
│ │ ├── Selectable.cs
│ │ ├── SelectableType.cs
│ │ ├── Selectors.cs
│ │ ├── SelectorType.cs
│ │ ├── TextSelectable.cs
│ │ └── XPathSelector.cs
│ ├── ServiceCollectionExtensions.cs
│ ├── Spider.cs
│ ├── SpiderException.cs
│ ├── SpiderOptions.cs
│ └── Statistics
│ ├── IStatisticsClient.cs
│ ├── ServiceCollectionExtensions.cs
│ ├── StatisticsClient.cs
│ ├── StatisticsService.cs
│ └── Store
│ ├── AgentStatistics.cs
│ ├── DefaultStatisticsStore.cs
│ ├── IStatisticsStore.cs
│ └── SpiderStatistics.cs
├── DotnetSpider.Agent
│ ├── appsettings.json
│ ├── DotnetSpider.Agent.csproj
│ ├── Program.cs
│ └── Properties
│ └── launchSettings.json
├── DotnetSpider.AgentCenter
│ ├── appsettings.json
│ ├── DotnetSpider.AgentCenter.csproj
│ ├── logs
│ │ ├── agent-register-20200403.txt
│ │ └── agent-register-20200404.txt
│ └── Program.cs
├── DotnetSpider.HBase
│ ├── DotnetSpider.HBase.csproj
│ └── HBaseStorage.cs
├── DotnetSpider.Mongo
│ ├── DotnetSpider.Mongo.csproj
│ ├── MongoEntityStorage.cs
│ └── MongoOptions.cs
├── DotnetSpider.MySql
│ ├── AgentCenter
│ │ ├── MySqlAgentStore.cs
│ │ └── MySqlStatisticsStore.cs
│ ├── DotnetSpider.MySql.csproj
│ ├── MySqlEntityStorage.cs
│ ├── MySqlFileEntityStorage.cs
│ ├── MySqlOptions.cs
│ └── Scheduler
│ ├── MySqlQueueBfsScheduler.cs
│ ├── MySqlQueueDfsScheduler.cs
│ ├── MySqlQueueScheduler.cs
│ ├── MySqlSchedulerOptions.cs
│ └── ServiceCollectionExtensions.cs
├── DotnetSpider.Portal
│ ├── appsettings.json
│ ├── BackgroundService
│ │ ├── CleanDockerContainerService.cs
│ │ ├── QuartzJob.cs
│ │ └── QuartzService.cs
│ ├── bundleconfig.json
│ ├── Common
│ │ ├── ActionResultTypeMapper.cs
│ │ ├── HttpClientFactory.cs
│ │ ├── MapperExtensions.cs
│ │ ├── PagedQueryExtensions.cs
│ │ ├── PrincipalExtensions.cs
│ │ └── ServiceProvider.cs
│ ├── Controllers
│ │ ├── AgentController.cs
│ │ ├── API
│ │ │ ├── AgentController.cs
│ │ │ ├── ApiResult.cs
│ │ │ └── SpiderController.cs
│ │ ├── HomeController.cs
│ │ └── SpiderController.cs
│ ├── Data
│ │ ├── PortalDbContext.cs
│ │ ├── Spider.cs
│ │ └── SpiderHistory.cs
│ ├── DDL
│ │ ├── MySql.sql
│ │ └── SqlServer.sql
│ ├── DotnetSpider.Portal.csproj
│ ├── Migrations
│ │ ├── 20200403153240_init.cs
│ │ ├── 20200403153240_init.Designer.cs
│ │ ├── 20200520010613_AddDockerVolume.cs
│ │ ├── 20200520010613_AddDockerVolume.Designer.cs
│ │ ├── 20200521083459_RemoveTypeColumn.cs
│ │ ├── 20200521083459_RemoveTypeColumn.Designer.cs
│ │ └── PortalDbContextModelSnapshot.cs
│ ├── package.json
│ ├── PortalOptions.cs
│ ├── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── SeedData.cs
│ ├── Startup.cs
│ ├── ViewObject
│ │ ├── AgentHeartbeatViewObject.cs
│ │ ├── AgentViewObject.cs
│ │ ├── AutoMapperProfile.cs
│ │ ├── ListSpiderViewObject.cs
│ │ ├── SpiderHistoryViewObject.cs
│ │ └── SpiderViewObject.cs
│ ├── Views
│ │ ├── Agent
│ │ │ ├── Heartbeat.cshtml
│ │ │ └── Index.cshtml
│ │ ├── Home
│ │ │ └── Index.cshtml
│ │ ├── Shared
│ │ │ ├── _Layout.cshtml
│ │ │ ├── Pagination.cshtml
│ │ │ ├── Select2.cshtml
│ │ │ ├── _SideBar.cshtml
│ │ │ └── _ValidationScriptsPartial.cshtml
│ │ ├── Spider
│ │ │ ├── History.cshtml
│ │ │ └── Index.cshtml
│ │ ├── _ViewImports.cshtml
│ │ └── _ViewStart.cshtml
│ └── wwwroot
│ ├── css
│ │ ├── site.css
│ │ ├── site.min.css
│ │ └── sweetalert.css
│ ├── favicon.ico
│ └── js
│ ├── agentHeartbeat.js
│ ├── agent.js
│ ├── pagination.js
│ ├── select2.js
│ ├── site.js
│ ├── spiderHistory.js
│ ├── spider.js
│ ├── sweetalert
│ │ └── sweetalert.css
│ └── sweetalert.js
├── DotnetSpider.PostgreSql
│ ├── DotnetSpider.PostgreSql.csproj
│ ├── PostgreOptions.cs
│ └── PostgreSqlEntityStorage.cs
├── DotnetSpider.RabbitMQ
│ ├── DotnetSpider.RabbitMQ.csproj
│ ├── PersistentConnection.cs
│ ├── RabbitMQMessageQueue.cs
│ ├── RabbitMQOptions.cs
│ └── ServiceCollectionExtensions.cs
├── DotnetSpider.Sample
│ ├── appsettings.json
│ ├── cat.html
│ ├── DotnetSpider.Sample.csproj
│ ├── Program.cs
│ └── samples
│ ├── BaseUsage.cs
│ ├── CnblogsSpider.cs
│ ├── DatabaseSpider.cs
│ ├── DistributedSpider.cs
│ ├── EntitySpider.cs
│ ├── GithubSpider.cs
│ ├── ImageSpider.cs
│ ├── JsonEntitySpider.cs
│ ├── ProxySpider.cs
│ ├── SpeedSpider2.cs
│ ├── SpeedSpider.cs
│ ├── test.json
│ ├── TestSpider2.cs
│ └── WholeSiteSpider.cs
├── DotnetSpider.Spiders
│ ├── appsettings.json
│ ├── DotnetSpider.Spiders.csproj
│ ├── EntitySpider.cs
│ └── Program.cs
└── DotnetSpider.Tests
├── appsettings.json
├── cnblogs.html
├── CollectNewRequestTests.cs
├── DataParser2.cs
├── DataParserTests.cs
├── DataParserTests`.cs
├── DotnetSpider.Tests.csproj
├── FormatterTests.cs
├── HashSetDuplicateRemoverTest.cs
├── Jd.html
├── JsonSelectorTests.cs
├── ModelTests.cs
├── MongoEntityStorageTests.cs
├── MySqlEntityStorageTests.cs
├── MySqlQueueSchedulerTests.cs
├── QueueSchedulerTests.cs
├── RabbitMQTests.cs
├── RequestedQueueTests.cs
├── RequestTests.cs
├── SelectorTests.cs
├── SqlServerEntityStorageTests.cs
├── StorageTests.cs
├── SystemInformationTests.cs
├── TestBase.cs
└── test.json
63 directories, 371 files
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论