Rectangle 27 0

java Jsoup how to get values from html?


*:contains(Studio) > a[title]
doc.select("span:contains(Studios) + a[href][title]");

It should be

Just in case, given selector will select only one link and in span More universal could be

Ok that seems to make sense but if I try Elements studio = doc.select("span:contains(Studios) > a[href][title]"); for(Element link : studio){ System.out.println(link.attr("title")); } Nothing prints out.

Perfect! Thanks a lot!

So basicly this selector gets all span elements that contains text Studios and then gets 1 level children a elements having attributes href and title

and that means - take every a element that has title attribute and is direct children of any (*) element that contains test Studio. Contains takes into account all text from descending children as well. For text of specific element :textOwn is used.

my bad didnt read html well. it should be + insteed of >

of I assume that span is common element for list header.

Note
Rectangle 27 0

java Jsoup how to get values from html?


...
    Elements studio = doc.select("a[@title='Kyoto Animations']");
    ...

Not tested, but what about something like

The problem is if it's a different show on the website, it wouldn't necessarily be Kyoto Animation. "Studio:" is consist on other pages, so I want to find that, then pull the specific studio ie Kyoto Animation in this case.

Note