I try to get a proxy list from this url:
Free proxy list
This would be cool, but port number is dynamic JavaScript content. How can I get JavaScript-generated content from this page? I have jsoup and djNativeSwing but I want do this in background thread.
JWebBrowser webBrowser = new JWebBrowser();
webBrowser.navigate("http://spys.ru/en/free-proxy-list/");
System.out.println(webBrowser.getHTMLContent());
this code returns a Null result. Help please.
The webbrowser hasn't finnished loading when you call the getHtmlContent() method. Use something like this instead:
JWebBrowser webBrowser = new JWebBrowser();
webBrowser.navigate("http://spys.ru/en/free-proxy-list/");
webBrowser.addWebBrowserListener(new WebBrowserListener(){
public void loadingProgressChanged(WebBrowserEvent e){
if(e.getWebBrowser().getLoadingProgress()==100)
System.out.println(webBrowser.getHTMLContent());
}
}
/* Note: I wrote this in the comment field without any testing,
you probably have to make the webBrowser final. */
JavaDocs is your friend!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With