Closed pgshow closed 3 years ago
Hello, you should check htmlquery.FindOne(n, "//td[2]")
return value whether is nil
before call htmlquery.InnerText
. if n:=htmlquery.FindOne(n, "//td[2]");n!=nil{fmt.Println(htmlquery.InnerText(n)}
another, htmlquery.InnerText(htmlquery.FindOne(n, "//td[2]"))
return ""
instead of panic will cause confusing we don't know there is not find node or found node that it's value is empty.
Ok, I will always check nil, for InnerText
htmlquery.InnerText(htmlquery.FindOne(n, "//td[2]"))
In this code, if htmlquery.FindOne(n, "//td[2]") is nil, so htmlquery.InnerText will throw out an error, which is not convincing. Better to return a nil too.