Skip to content

Latest commit

 

History

History
42 lines (33 loc) · 1.43 KB

README.md

File metadata and controls

42 lines (33 loc) · 1.43 KB

OpenGrape is a Java-based Open Graph parser

The Open Graph Protocol is a metadata standard that enables services, like social media applications, to fetch previews of webpages, such as thumbnail images and summaries.

This Orbit Earth OpenGrape is a friendly fork of the excellent Kientux OpenGrape, which is a Java port of the Swift OpenGraph.

Installation

Unlike Kientux OpenGrape, this version is not hosted in a public Maven repository, but must be built and installed locally using mvn install.

<dependency>
    <groupId>social.orbitearth</groupId>
    <artifactId>opengrape</artifactId>
    <version>2.0.1</version>
</dependency>

Usage

OpenGrape og = new OpenGrape();
Map<OpenGrapeMetadata, String> metadata = og.fetch("https://opengraphprotocol.org/");
String title = metadata.get(OpenGrapeMetadata.TITLE);
System.out.println(title);

Versions

  • 1.0.0 Initial fork
  • 1.0.1 Added Slf4j logging
  • 1.0.2 New user agent that works more broadly
    • Java 17
  • 2.0.0 Changed OpenGrape class from static to instance
    • Handles Youtube urls
    • Removed the removal of trailing / from urls.
  • 2.0.1 Succeeds against some Twitter pages it couldn't parse before, because parsing now uses JSoup.
    • Uses maven assembly jar to bundle dependencies Slf4j, JSoup.