0

I have a web scraper and I'm trying to get some text and write it in a CSV file. The HTML structure is: I have a div with class="css-1nrl4q4"; inside this div I have another div without class, and inside this second div I have two p elements that contain the wanted info.

c.OnHTML(".css-1nrl4q4", func(e *colly.HTMLElement) { //class that contains wanted info
        writer.Write([]string{
            e.ChildText("p"), //specific tag of the info
            e.ChildText("div"),
        })
    })

I've written this but it won't work. (I also tried to change the order of p and div and also leave only p)

DvdiidI
  • 63
  • 6

1 Answers1

0

try:

e.ChildText(".class_name")
Junhan
  • 1
  • 1