This is Java version of the Swift version here: https://github.com/satoshi-takano/OpenGraph
<dependency>
<groupId>io.github.kientux</groupId>
<artifactId>opengrape</artifactId>
<version>1.0.5</version>
</dependency>
String url = "https://opengraphprotocol.org/";
try {
OpenGrape og = OpenGrape.fetch(url);
// or `OpenGrape.fetch(url, "my custom user-agent")`
String title = og.getValue(OpenGrapeMetadata.TITLE);
System.out.println(title);
} catch (IOException | OpenGrapeResponseException e) {
e.printStackTrace();
}