|
@ -19,18 +19,21 @@ func SpiderAiprose() { |
|
|
title := strings.TrimSpace(e.DOM.Find(".blog-title").Eq(0).Text()) |
|
|
title := strings.TrimSpace(e.DOM.Find(".blog-title").Eq(0).Text()) |
|
|
//author:=strings.TrimSpace(e.DOM.Find(".author-info a").Eq(0).Text())
|
|
|
//author:=strings.TrimSpace(e.DOM.Find(".author-info a").Eq(0).Text())
|
|
|
time := strings.TrimSpace(e.DOM.Find(".author-info span").Eq(0).Text()) |
|
|
time := strings.TrimSpace(e.DOM.Find(".author-info span").Eq(0).Text()) |
|
|
|
|
|
catelog := strings.TrimSpace(e.DOM.Find(".author-info .catelog-name").Text()) |
|
|
content := strings.TrimSpace(e.DOM.Find(".blog-detaile").Eq(0).Text()) |
|
|
content := strings.TrimSpace(e.DOM.Find(".blog-detaile").Eq(0).Text()) |
|
|
nodes := e.DOM.Find(".blog-label label").Nodes |
|
|
nodes := e.DOM.Find(".blog-label label").Nodes |
|
|
|
|
|
catelogs := []string{catelog} |
|
|
var tags []string |
|
|
var tags []string |
|
|
for _, node := range nodes { |
|
|
for _, node := range nodes { |
|
|
tags = append(tags, htmlquery.InnerText(node)) |
|
|
tags = append(tags, htmlquery.InnerText(node)) |
|
|
} |
|
|
} |
|
|
saveBlog(title, content, time, tags) |
|
|
saveBlog(title, content, time, tags, catelogs) |
|
|
}) |
|
|
}) |
|
|
c.OnRequest(func(r *colly.Request) { |
|
|
c.OnRequest(func(r *colly.Request) { |
|
|
fmt.Println("Visiting", r.URL) |
|
|
fmt.Println("Visiting", r.URL) |
|
|
}) |
|
|
}) |
|
|
c.UserAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36" |
|
|
c.UserAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36" |
|
|
c.Visit("https://www.aiprose.com/blogs") |
|
|
c.Visit("https://www.aiprose.com/blogs") |
|
|
|
|
|
//c.Visit("https://www.aiprose.com/blog/143")
|
|
|
c.Wait() |
|
|
c.Wait() |
|
|
} |
|
|
} |
|
|