0

I'm trying to get the content from a website, that uses "onClick" instead of "href" in hyperlinks, so the url is always the same, despite of the page you are seeing.

http://www.sas.ul.pt/index.php

This is the website, and the content i'm trying to get is inside "Alimentação" > "Estudantes".

<a href="#" onclick="return go('','4;02');" title="Estudantes">Estudantes</a>

Is this possible with Jsoup?

1
  • Urgh - a whole website of inline onClicks? Anyway, no, that's going to be might hard, unless you understand what those go() function calls mean and can somehow parse them and convert them into actual URIs. Commented Jul 26, 2012 at 17:20

2 Answers 2

1
Jsoup.connect(url).data("nav", "index@4;02", "opt", "4;02", "chvP", "127").post();
Sign up to request clarification or add additional context in comments.

Comments

0

You can get the value of onclick with jsoup

http://jsoup.org/cookbook/extracting-data/attributes-text-html

Just replace the line

String linkHref = link.attr("href"); with this String handler = link.attr("onclick");

However after that there is no way to construct the URL unless you can somehow map the magic number to 4,02

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.