-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
40 lines (37 loc) · 1.05 KB
/
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
39
40
package main
import (
"goCrawler/engine"
"goCrawler/persist"
"goCrawler/scheduler"
"goCrawler/zcool/parser"
"log"
)
/**
Go站酷爬虫
@author yinlei
@date 2022/3/3
*/
func main() {
itemSaver, err := persist.ItemSaver("golang_spa", "zcool")
if err != nil {
log.Printf("elastic search error: %v", err)
}
e := engine.ConcurrentEngine{
Scheduler: &scheduler.QueueScheduler{},
WorkerCount: 50,
ItemChan: itemSaver,
}
e.Run(engine.Request{
//Url: "https://www.zcool.com.cn/discover?cate=1&subCate=0&hasVideo=0&city=0&college=0&recommendLevel=2&sort=9&page=1",
Url: "https://www.zcool.com.cn/discover?cate=33&hasVideo=0&city=0&college=0&recommendLevel=2&sort=9&page=1",
ParserFunc: parser.ParseCateList,
})
//e.Run(engine.Request{
// Url: "https://www.zcool.com.cn/discover?cate=1&subCate=3&hasVideo=0&city=0&college=0&recommendLevel=2&sort=9&page=1",
// ParserFunc: parser.ParsePost,
//})
//e.Run(engine.Request{
// Url: "https://www.zcool.com.cn/work/ZNTgzMjQ2ODg=.html",
// ParserFunc: parser.ParsePostDetail,
//})
}