2

I'm trying to parse this nested HTML from a website but I just can't seen to figure out how to get the data out of the unordered list.

<ul class="no-bullet participants-list" data-registrations="registrants">
     <li class="participant" data-participant-id="512028" data-registrations="registrant">
         <div class="row collapse participant-info">
             <div class="large-1 small-2 columns"> 
                 <figure class="participant-avatar">
                    <a class="user-profile-link" href="THE LINK I WANT">

What I've tried

for(Element row : doc.select("ul.no-bullet participants-list")) {
         row.select("li.participant")
             .select("div.row collapse participant-info")
             .select("div.large-1 small-2 columns")
             .select("figure.participant-avatar")
             .select("a.href").text());
}

Not sure what I'm doing wrong

1 Answer 1

2

As I understand you are looking for href attribute inside a tag Your's select statement is not correct because you use space instead of dot in order to choose class

Instead of this

doc.select("ul.no-bullet participants-list")

Use this

doc.select("ul.no-bullet.participants-list a").first().attr("href")

As you see I chose first a tag and fetched href from this tag

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.