2

I've just started out using JSoup to get small text from websites but I just can't figure out how to get the word "BONES" from the class "title":

<a href="https://anilist.co/studio/4/BONES" target="_blank" ng-show="b.studio.name">BONES</a>

Here's my code:

Document doc = Jsoup.connect("http://anichart.net/Winter-2019").userAgent("mozilla/17.0").get();
        Elements temp = doc.select("div.title");

        for(Element s : temp) {
            System.out.println(s.getElementsByTag("a").text());
        }
Mike TT
  • 35
  • 4
  • does a tag inside title element? Also why not get all the link? `Elements temp = doc.select("a");` – parlad Jan 06 '19 at 04:59
  • Sorry, I guess I was really unclear. I want the word BONES between the tags not inside the link. – Mike TT Jan 06 '19 at 05:10
  • a is anchor tag which is a link i refer. – parlad Jan 06 '19 at 05:23
  • Yes, the tag BONES links you to another webpage. I just need the word BONES, not the link. I'm not sure I follow... – Mike TT Jan 06 '19 at 05:30
  • If you print the entire page `System.out.println(doc.html())` you will see that the page is demanding javascript enabled: 'Sorry, AniList requires Javascript.' So, the content you are looking for is not there. – Rcordoval Jan 06 '19 at 06:06
  • Dang! Oh well, thanks for the help. Is there a way to make your comment as a solution. – Mike TT Jan 06 '19 at 06:38

1 Answers1

0

this page is generated by javascript using ajax, you can find the data in chrome dev tool:

enter image description here

宏杰李
  • 11,820
  • 2
  • 28
  • 35
  • I'm not really following how does this relate to getting a single element from the web page into java? I've never used ajax before. I know where the data is I just can't figure out how to get it in java. – Mike TT Jan 06 '19 at 05:18