I
I
Ivan2021-04-08 15:26:44
go
Ivan, 2021-04-08 15:26:44

How to extract information from the second div in the GO parser if there are several of them with the same class?

Good afternoon. I do a search by class container, and then I need to pull out information only from the second div with the class . profile-page-sectionFrom the first one, you can pull out the method First(), but what about the second one? Second() does not exist as far as I understand.

docInner.Find(".container").Each(func(i int, s *goquery.Selection) {
      longDescription = s.Find(".profile-page-section").First().Text()
    })


606ef66c60e96411458352.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Korotenko, 2021-04-08
@Djonson86

I could be wrong but [1] instead of First just check the length of the collection

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question