This library generates a preview for a link or for a text containing any number of links. Its functionality is aligned with link-preview-js as I was looking for an alternative to this library for Java but couldn't find any.
<dependency>
<groupId>com.github.auties00</groupId>
<artifactId>link-preview</artifactId>
<version>2.4</version>
</dependency>
-
Groovy DSL
implementation 'com.github.auties00:link-preview:2.4'
-
Kotlin DSL
implementation("com.github.auties00:link-preview:2.4")
-
Text
LinkPreview.createPreviews("This is a string containing links: google.com");
-
URI
LinkPreview.createPreviews(URI.create("https://google.com/"));