fix: fix crawler compilation errors

This commit is contained in:
小萝
2026-04-29 09:08:00 +00:00
parent a847d2a8ac
commit 7ef1918c87
+5 -9
View File
@@ -58,15 +58,10 @@ func (c *RibenyanCrawler) CrawlArticles() error {
return
}
// 获取链接
link := ""
// 获取链接(暂时不使用)
s.Find("a").First().Each(func(j int, ls *goquery.Selection) {
href, exists := ls.Attr("href")
if exists && !strings.HasPrefix(href, "http") {
link = "https://ribenyan.com" + href
} else if exists {
link = href
}
_, exists := ls.Attr("href")
_ = exists
})
// 获取封面图
@@ -199,7 +194,8 @@ func (c *RibenyanCrawler) CrawlArticleDetail(url string) (*models.Article, error
// 获取内容
var contentBuilder strings.Builder
doc.Find("article, .post-content, .article-content, .entry-content").First().Each(func(i int, s *goquery.Selection) {
contentBuilder.WriteString(s.Html())
html, _ := s.Html()
contentBuilder.WriteString(html)
})
article.Content = contentBuilder.String()