user2536847
user2536847

Reputation: 25

Jsoup parsing not showing content between <body> tags

I tried to parse http://jobs.hasbro.com/search using Jsoup but the content between tags didn't show for some reason. What am I missing? Thanks.

doc = Jsoup.connect("http://jobs.hasbro.com/search").get();
System.out.println(Jsoup.parse(doc.html()));

I tested with other random websites and saw that the parse was working ok. I am using Jsoup 1.7.2 and JDK 1.7

Upvotes: 0

Views: 333

Answers (1)

Niranjan
Niranjan

Reputation: 1844

Include the userAgent in your request

Document document = Jsoup.connect("http://jobs.hasbro.com/search")
                            .userAgent("Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36")
                            .timeout(0).followRedirects(true).execute().parse();
        System.out.println(document.html());

Upvotes: 1

Related Questions