I want to extract/parse the body of HTML pages. To do so, I use the Jsoup API: https://jsoup.org/.
However, I also want to extract the CSS, but how to do it when it is in a different folder ?
My code so far is writing the code of the page in a tempFile, so I now need to get the CSS of this page to apply it in this file:
public File parseHtml(String url) throws IOException {
Document doc = Jsoup.connect(url).get();
Element body = doc.body();
File tempFile = File.createTempFile(suffix, prefix);
BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile));
writer.write(body.outerHtml());
writer.close();
return tempFile;
}