OpenGraphKt is a minimalist Kotlin multiplatform library to work with the Open Graph tags protocol. OpenGraphKt is a tiny wrapper on top of JSoup.
- Library can extract OpenGraph tags from HTML via a
URL
,String
orFile
input. - Protocol implementation is complete for
og:
tags, but types aren't fully correct (most types currently areString
). - Library should be considered in pre-alpha, use this in production at your own risks :).
See Main.kt in the demo-remote
submodule for usage examples.
In short :
- Add dependency to your Maven / Gradle file. For example :
implementation("fr.lengrand:opengraphkt:0.1.0")
- Enjoy:
val parser = Parser()
val openGraphDataDoc = parser.parse("https://www.imdb.com/title/tt0068646/")
println("Title: ${openGraphDataDoc.title}")
println("Is valid: ${openGraphDataDoc.isValid()}")
// Title: The Rock
// Is valid: true