-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
38 lines (34 loc) · 867 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
import (
"crawler/engine"
"crawler/scheduler"
"crawler/persist"
"crawler/zhenai/parser"
)
func main() {
//simpleEngine := engine.SimpleEngine{}
//simpleEngine.Run(engine.Request{
// Url: "https://www.zhenai.com/zhenghun",
// ParserFunc: parser.ParseCityList,
//})
itemChan, err := persist.ItemSaver()
if err != nil {
panic(err)
}
e := &engine.ConcurrentEngine{
Scheduler: &scheduler.QueuedScheduler{},
//Scheduler: &scheduler.SimpleScheduler{},
WorkerCount: 100,
ItemChan: itemChan,
}
e.Run(engine.Request{
//Url: "https://www.zhenai.com/zhenghun",
//ParserFunc: parser.ParseCityList,
Url: "http://www.zhenai.com/zhenghun/beijing",
ParserFunc: parser.ParseCity,
})
//e.Run(engine.Request{
// Url: "http://www.zhenai.com/zhenghun/beijing",
// ParserFunc: parser.ParseCity,
//})
}