Click here to Skip to main content
15,889,843 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello every one.

I am building an application which collects info about courses, so I need to access some info in coursera.org, I need to acces this info from my java code so I use jsoup to do that.

When I show the source code in the firefox browser I don't get the html code but I get some javascript code and I can't get the textual info I need from it.

Using jsoup to get this info:

String url ="https://www.coursera.org/learn/machine-learning";
Document doc = Jsoup.connect(url).get();
System.out.println(doc.text());

I get this message:

Please use amodern browser with JavaScript enabled to use Coursera.

So is there anyway to view the source code or get it using jsoup.

Please, any help would be appreciated.

Thanks in advance.
Posted
Comments
Sergey Alexandrovich Kryukov 31-Jul-15 17:41pm    
You always get the full source code when you send HTTP request and receive HTTP response. What you describe is the behavior on the client side, when exact source code is already there. It's the browser checks up its state (options, for example) and generates the message.
—SA

Please see my comment to the question. The techniques used to handle scripts when JavaScript is disabled in the browser are explained here:
http://www.w3.org/TR/2011/WD-html5-author-20110705/the-noscript-element.html[^],
https://www.w3.org/wiki/HTML/Elements/noscript[^].

This is not related to the source code of the page. You always get an actual source code on the client side.

—SA
 
Share this answer
 
Thank you for your answer, I tried to solve that using your comment but until now I coupdn't.

But I solved my problem using the coursera API:

https://tech.coursera.org/app-platform/catalog/[^]

Where I can get to any text info using URLs provided in this API.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900