Skip to content

Instantly share code, notes, and snippets.

@jhy
Created May 17, 2019 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhy/18b4e8f6746fffec35dca9cc4cee9b7b to your computer and use it in GitHub Desktop.
Save jhy/18b4e8f6746fffec35dca9cc4cee9b7b to your computer and use it in GitHub Desktop.
import org.jsoup.Jsoup;
import java.io.IOException;
class Scratch {
public static void main(String[] args) throws IOException {
String html = "<a href=\"http://www.okbih.ba/pdf/financial_guidelines/C%20-%202013-2016%20Financial%20Report.xlsx\">Link</a>";
String link = Jsoup.parse(html).selectFirst("a").attr("href");
byte[] bytes = Jsoup.connect(link)
.proxy("localhost", 8888)
.ignoreContentType(true)
.execute()
.bodyAsBytes();
System.out.println(bytes.length);
}
}
@jhy
Copy link
Author

jhy commented May 17, 2019

Output is,

"C:\Program Files\Java\jdk-9.0.1\bin\java.exe"...
129522

Process finished with exit code 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment