goquery 1.1.0 发布了,该版本增加了 SetHtml 和 SetText 方法。 goquery是一个使用go语言写成的HTML解析库,可以让你像jQuery那样的方式来操作DOM文档。 示例代码: package main import ( "fmt" "log" "github.com/PuerkitoBio/goquery" ) func ExampleScrape() { doc, err := goquery.NewDocument("http://metalsucks.net") if err != nil { log.Fatal(err) } // Find the review items doc.Find(".sidebar-reviews article .content-block").Each(func(i int, s *goquery.Selection) { // For each item found, get the band and title band := s.Find("a").Text() title := s.Find("i").Text() fmt.Printf("Review %d: %s - %s\n", i, band, title) }) } func main() { ExampleScrape() } goquery 1.1.0 发布,Go 语言的 HTML 解析器下载地址