mirror of
https://github.com/jlengrand/OpenGraphKt.git
synced 2026-03-10 08:31:23 +00:00
91da68172f8cf4698e5d20af86a4720188d36631
OpenGraphKt
OpenGraphKt is a minimalist Kotlin library to work with the Open Graph tags protocol. OpenGraphKt is a tiny wrapper on top of JSoup.
Current status
- Library can extract OpenGraph tags from HTML via a
URL,StringorFileinput. - Current implementation is JVM only, due to the
JSoupdependency. - 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 :).
Usage
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.0.2")
- 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
Dependencies
Author
License
Languages
Kotlin
100%