Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
zlzforever authored May 29, 2024
1 parent c6e032e commit 4ec8c0f
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ https://github.com/dotnetcore/DotnetSpider/wiki
[View complete Codes](https://github.com/zlzforever/DotnetSpider/blob/master/src/DotnetSpider.Sample/samples/EntitySpider.cs)

````csharp
[DisplayName("博客园爬虫")]
public class EntitySpider(
IOptions<SpiderOptions> options,
DependenceServices services,
Expand All @@ -92,21 +93,6 @@ public class EntitySpider(
await builder.Build().RunAsync();
}

public static async Task RunMySqlQueueAsync()
{
var builder = Builder.CreateDefaultBuilder<EntitySpider>(options =>
{
options.Speed = 1;
});
builder.UseSerilog();
builder.IgnoreServerCertificateError();
builder.UseMySqlQueueBfsScheduler((context, options) =>
{
options.ConnectionString = context.Configuration["SchedulerConnectionString"];
});
await builder.Build().RunAsync();
}

protected override async Task InitializeAsync(CancellationToken stoppingToken = default)
{
AddDataFlow<DataParser<CnblogsEntry>>();
Expand All @@ -116,11 +102,6 @@ public class EntitySpider(
"https://news.cnblogs.com/n/page/1", new Dictionary<string, object> { { "网站", "博客园" } }));
}

protected override SpiderId GenerateSpiderId()
{
return new(ObjectId.CreateId().ToString(), "博客园");
}

[Schema("cnblogs", "news")]
[EntitySelector(Expression = ".//div[@class='news_block']", Type = SelectorType.XPath)]
[GlobalValueSelector(Expression = ".//a[@class='current']", Name = "类别", Type = SelectorType.XPath)]
Expand Down Expand Up @@ -170,7 +151,6 @@ public class EntitySpider(
}
}


````

#### Distributed spider
Expand Down

0 comments on commit 4ec8c0f

Please sign in to comment.