Set the user-agent header:
java
.userAgent("Mozilla")
Example:
js
Document document = Jsoup.connect("https://stackoverflow.com/questions/11970938/java-html-parser-to-extract-specific-data").userAgent("Mozilla").get();
Elements elements = document.select("span.hidden-text");
for (Element element : elements) {
System.out.println(element.text());
}
Stack Exchange
Inbox
Reputation and Badges
source: https://stackoverflow.com/a/7523425/1048340
Perhaps this is related: https://meta.stackexchange.com/questions/277369/a-terms-of-service-update-restricting-companies-that-scrape-your-profile-informa