@@ -75,6 +75,7 @@ https://github.com/dotnetcore/DotnetSpider/wiki
75
75
[ View complete Codes] ( https://github.com/zlzforever/DotnetSpider/blob/master/src/DotnetSpider.Sample/samples/EntitySpider.cs )
76
76
77
77
```` csharp
78
+ [DisplayName (" 博客园爬虫" )]
78
79
public class EntitySpider (
79
80
IOptions <SpiderOptions > options ,
80
81
DependenceServices services ,
@@ -92,21 +93,6 @@ public class EntitySpider(
92
93
await builder .Build ().RunAsync ();
93
94
}
94
95
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
-
110
96
protected override async Task InitializeAsync (CancellationToken stoppingToken = default )
111
97
{
112
98
AddDataFlow <DataParser <CnblogsEntry >>();
@@ -116,11 +102,6 @@ public class EntitySpider(
116
102
" https://news.cnblogs.com/n/page/1" , new Dictionary <string , object > { { " 网站" , " 博客园" } }));
117
103
}
118
104
119
- protected override SpiderId GenerateSpiderId ()
120
- {
121
- return new (ObjectId .CreateId ().ToString (), " 博客园" );
122
- }
123
-
124
105
[Schema (" cnblogs" , " news" )]
125
106
[EntitySelector (Expression = " .//div[@class='news_block']" , Type = SelectorType .XPath )]
126
107
[GlobalValueSelector (Expression = " .//a[@class='current']" , Name = " 类别" , Type = SelectorType .XPath )]
@@ -170,7 +151,6 @@ public class EntitySpider(
170
151
}
171
152
}
172
153
173
-
174
154
````
175
155
176
156
#### Distributed spider
0 commit comments