Solution 1 :

You should be able to use standard selectors to get the data you want from the Document.select() method. The easiest way to get this would be to open the web page in your browser’s inspector, inspect that element specifically, then context-click its node in the element viewer and select Copy -> Selector Path.

Personally, I’ve experienced pretty substantial trouble with JSoup and have found that injecting artoo.js is usually a quicker way to get what I want out of a page regardless of environment.

Problem :

I’m wondering if anyone is familiar with parsing a specific part of a website’s HTML, such as getting a current temperature or current conditions from a website using JSoup? I’ve searched all over and it seems like all the examples are people using for each loops to extract a list. For example in the picture I attached, I only want to parse the -3 degrees into my IDE. Any help would be greatly appreciated! Thanks!

Picture:

1

Comments

Comment posted by DanielBK

Well I think in any case JSoup will offer you the full HTML document of the web page. And you basically will need to find the tag you need inside of this document. Therefore you should roughly know, where it is located. For example, inside of the first

and there inside of the second

… and so on all the way down to the element you are looking for. On the other hand, you can try simply to search the document for the “°C” string, but this is of course not very safe 🙂

Comment posted by Jonathan Hedley

What’s the URL you’re trying to get this from?

Comment posted by whistlerblackcomb.com/the-mountain/mountain-conditions/…

Hey Jonathan, that picture was from grousemountain.com and I successfully parsed the temperature into my IDE, however when I’m trying to do this off of

By