How can I get the value of a span tag with jsoup?

Asked

Viewed 23 times

-1

public class Main {

    public static void main(String[] args) throws IOException {
    // write your code here
        Document doc = (Document) Jsoup.connect("https://cod.tracker.gg/warzone/profile/atvi/dezk%236971848/overview").get();
        System.out.println(doc.getElementsByClass("value").get(0));
    }
}

Brings me the result:

<span class="value" data-v-5edf1b22>67</span>

Only I want to take only the value 67.

1 answer

0


Just run the method text():

System.out.println(doc.getElementsByClass("value").get(0).text());

Browser other questions tagged

You are not signed in. Login or sign up in order to post.