I have problems parsing empty meta tags the golang.org/x/net/html-parser.
For example, this is a common Open Graph meta-tag:
<meta property="og:type" content="article" />
The following code does NOT parse the meta element.
func main() {
doc := strings.NewReader(`<html><head><meta property="og:type" content="article" /></head></html>`)
z := html.NewTokenizer(doc)
for {
tt := z.Next()
switch tt {
case html.StartTagToken:
t := z.Token()
fmt.Println(t.Type, t.Data)
case html.ErrorToken:
fmt.Println(z.Err())
return
}
}
}