Lztkdr.SeleniumSpider
0.0.1
See the version list below for details.
dotnet add package Lztkdr.SeleniumSpider --version 0.0.1
NuGet\Install-Package Lztkdr.SeleniumSpider -Version 0.0.1
<PackageReference Include="Lztkdr.SeleniumSpider" Version="0.0.1" />
paket add Lztkdr.SeleniumSpider --version 0.0.1
#r "nuget: Lztkdr.SeleniumSpider, 0.0.1"
// Install Lztkdr.SeleniumSpider as a Cake Addin #addin nuget:?package=Lztkdr.SeleniumSpider&version=0.0.1 // Install Lztkdr.SeleniumSpider as a Cake Tool #tool nuget:?package=Lztkdr.SeleniumSpider&version=0.0.1
一个基于Selenium/Chrome浏览器池的爬虫类库。
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.Extensions.ObjectPool (>= 3.1.8)
- Selenium.Support (>= 3.141.0)
- Selenium.WebDriver (>= 3.141.0)
- Selenium.WebDriverBackedSelenium (>= 3.141.0)
- Serilog (>= 2.10.0)
- Serilog.Sinks.Console (>= 3.1.1)
- Serilog.Sinks.File (>= 4.1.0)
- System.Drawing.Common (>= 4.7.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
# 使用示例:
//最大池为5的谷歌浏览器池,默认先打开百度
using DriverMgr mgr = DriverMgr.Instance("https://www.baidu.com/", 5);
//using DriverMgr mgr = DriverMgr.Instance(5, DriverConfig.Spider("https://www.baidu.com/", null, DeviceType.Pad));
//先尝试关闭所有驱动以及浏览器
//mgr.Dispose();
var lstTask = new List<Task>();
//处理10条数据
for (int j = 0; j < 10; j++)
{
//启动线程
var task = Task.Run(() =>
{
//具体爬取逻辑
mgr.DoWork(driver =>
{
// 业务逻辑
});
});
lstTask.Add(task);
}
Task.WaitAll(lstTask.ToArray());
``