-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
56 lines (47 loc) · 882 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"strconv"
"fmt"
"crowl_douban_mv/engine"
"crowl_douban_mv/scheduler"
"crowl_douban_mv/fetcher"
)
var mvContent = make(chan string)
var mvUrl= make(chan string)
/*
文件测试
*/
func main() {
var i=0
var n=0
var num=0
urls:=make([]string,0)
for {
url:=`https://movie.douban.com/j/new_search_subjects?sort=T&range=0,10&tags=&start=`+strconv.Itoa(n)
fmt.Printf(url+"\n")
if n<9960{
urls=append(urls,url)
}
if n > 9960 {
_, err := fetcher.FetchUrls(url)
if err!=nil{
num++
s :=err.Error()
fmt.Println(s)
break
}
urls=append(urls,url)
}
n=(i+1)*20+1
i++
//time.Sleep(time.Duration(rand.Intn(100))*time.Millisecond)
}
fmt.Println(len(urls))
e:=engine.ConcurrentEngine{
Scheduler:&scheduler.QueuedScheduler{},
WorkerCount:5,
MvWorkerCount:4,
Total:20*(len(urls)-num),
}
e.Run(urls)
}