I am new to Golang and just started learning it. I want to find some information from a site and extract the data that I need. I am using the PuerkitoBio/goquery package to select elements and read from them. I would like to extract the data from this piece of html:
<ul class="cases-counter">
<li>Cases: <strong>457</strong><br></li>
<li>Active: <strong>16</strong><br></li>
</ul>
And this is the code that I have:
doc.Find(".cases-counter").Each(func(i int, s *goquery.Selection) {
text := s.Find("li").Text()
fmt.Print(i)
fmt.Printf(text)
})
This prints me:
0Cases: 457Active: 16
How can I print each li element
's text separately as two different variables in this example?