我想使用 goquery 获取 DOM 的类型名称,例如“a”、“img”、“tr”、“td”、“center”。我怎样才能得到?
package main
import (
"github.com/PuerkitoBio/goquery"
)
func main() {
doc, _ := goquery.NewDocument("https://news.ycombinator.com/")
doc.Find("html body").Each(func(_ int, s *goquery.Selection) {
// for debug.
println(s.Size()) // return 1
// I expect '<center>' on this URL, but I can't get it's name.
// println(s.First().xxx) // ?
})
}