I have the following function,
func getMosWantedInfo(doc *goquery.Document) {
doc.Find("div.flex-align-center.bg-base-lightest.padding-1.margin-1").Each(func(i int, s *goquery.Selection) {
// For each item found, get the title
title := s.Find("h3").Text()
reward := s.Find("span")
// iamge := s.Find("imag")
fmt.Println("###########")
fmt.Printf("SUSPECT %d: Name: %s\n", i, title)
fmt.Printf("SUSPECT %d REWARD: %s\n", i, reward)
fmt.Println("-----------")
})
// Handle what happens when doc.find doesnt find the article wanted
}
However, the title also retrieves the spans of the h3 tag, so how can I just get the text of h3?
Edit:
As an example:
<div>
<h3>
<span>Text to avoid</span>
Text to collect
</h3>
</div>