-
Notifications
You must be signed in to change notification settings - Fork 26
/
list1.go
29 lines (23 loc) · 1.19 KB
/
list1.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
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.cos-onsen.com",
Channel: "/product-list/46?view=new&page=[PAGE]",
Limit: 5,
PageStart: 1,
ListSelector: "#main_container > article > div > div.page_contents.clearfix.categorylist_contents > div > div.itemlist_box.clearfix > ul > li",
ListHrefSelector: "div > a",
DetailFields: map[string]form.Field{
"title": {Types: fileTypes.SingleField, Selector: "#main_container > article > div > div.page_title > h1 > span.goods_name"},
//"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]"},
},
}
spider.Start(f)
}