@@ -75,6 +75,7 @@ https://github.com/dotnetcore/DotnetSpider/wiki
7575[ View complete Codes] ( https://github.com/zlzforever/DotnetSpider/blob/master/src/DotnetSpider.Sample/samples/EntitySpider.cs )
7676
7777```` csharp
78+ [DisplayName (" 博客园爬虫" )]
7879public class EntitySpider (
7980 IOptions <SpiderOptions > options ,
8081 DependenceServices services ,
@@ -92,21 +93,6 @@ public class EntitySpider(
9293 await builder .Build ().RunAsync ();
9394 }
9495
95- public static async Task RunMySqlQueueAsync ()
96- {
97- var builder = Builder .CreateDefaultBuilder <EntitySpider >(options =>
98- {
99- options .Speed = 1 ;
100- });
101- builder .UseSerilog ();
102- builder .IgnoreServerCertificateError ();
103- builder .UseMySqlQueueBfsScheduler ((context , options ) =>
104- {
105- options .ConnectionString = context .Configuration [" SchedulerConnectionString" ];
106- });
107- await builder .Build ().RunAsync ();
108- }
109-
11096 protected override async Task InitializeAsync (CancellationToken stoppingToken = default )
11197 {
11298 AddDataFlow <DataParser <CnblogsEntry >>();
@@ -116,11 +102,6 @@ public class EntitySpider(
116102 " https://news.cnblogs.com/n/page/1" , new Dictionary <string , object > { { " 网站" , " 博客园" } }));
117103 }
118104
119- protected override SpiderId GenerateSpiderId ()
120- {
121- return new (ObjectId .CreateId ().ToString (), " 博客园" );
122- }
123-
124105 [Schema (" cnblogs" , " news" )]
125106 [EntitySelector (Expression = " .//div[@class='news_block']" , Type = SelectorType .XPath )]
126107 [GlobalValueSelector (Expression = " .//a[@class='current']" , Name = " 类别" , Type = SelectorType .XPath )]
@@ -170,7 +151,6 @@ public class EntitySpider(
170151 }
171152}
172153
173-
174154````
175155
176156#### Distributed spider
0 commit comments