Finding links in a web page using Java
2 answers
You can use HtmlUnit and then extract the references as easy as:
WebClient wc = new WebClient();
URL url = new URL("http://www.oogly.co.uk/");
HtmlPage page = (HtmlPage) wc.getPage(url);
PrintWriter printWriter = new PrintWriter(new FileWriter(FILE_NAME));
List anchors = page.getAnchors();
+4
a source to share