-
Notifications
You must be signed in to change notification settings - Fork 26
/
list.go
34 lines (28 loc) · 1.51 KB
/
list.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
package main
import (
"github.com/PeterYangs/article-spider/fileTypes"
"github.com/PeterYangs/article-spider/form"
"github.com/PeterYangs/article-spider/spider"
)
func main() {
f := form.Form{
Host: "https://www.ccaaka.com",
Channel: "/cate/32.html?page=[PAGE]",
Limit: 5,
PageStart: 2,
ListSelector: "body > section > div > div > div.col-md-7.col-xs-12.article-container > div",
ListHrefSelector: "div.col-md-8.col-xs-8 > a",
DetailFields: map[string]form.Field{
"title": {Types: fileTypes.SingleField, Selector: "body > section > div > div > div.col-md-7 > div:nth-child(2) > div > h3"},
//"image": {Types: fileTypes.SingleImage, Selector: "body > section > div > div > div.col-md-3 > div > div.info-panel > ul > li:nth-child(1) > img.left"},
//body > section > div > div > div.col-md-3 > div > div.info-panel > ul > li:nth-child(1) > img.left
//"html": {Types: fileTypes.OnlyHtml, Selector: "body > section > div > div > div.col-md-7 > div:nth-child(2) > div"},
//"image": {Types: fileTypes.SingleImage, Selector: "body > section > div > div > div.col-md-3 > div > div.qrcode-panel.common-panel > div:nth-child(1) > img", ImagePrefix: "upload", ImageDir: "[date:Ym]/[random:1-100]"},
//"content": {Types: fileTypes.HtmlWithImage, Selector: "#detail-content", ImagePrefix: "upload", ImageDir: "[date:Ym]/[random:1-100]"},
},
ListFields: map[string]form.Field{
"image": {Types: fileTypes.SingleImage, Selector: "div > img"},
},
}
spider.Start(f)
}