mirror of
https://github.com/jlengrand/OpenGraphKt.git
synced 2026-03-10 00:21:19 +00:00
52 lines
1.9 KiB
Markdown
52 lines
1.9 KiB
Markdown
# OpenGraphKt
|
|
|
|
[](https://github.com/simplex-chat/jlengrand/OpenGraphKt/workflows/gradle.yml)
|
|

|
|

|
|

|
|

|
|

|
|

|
|
|
|
|
|
[OpenGraphKt](https://github.com/jlengrand/OpenGraphKt) is a minimalist Kotlin multiplatform library to work with the [Open Graph tags](https://ogp.me/) protocol.
|
|
OpenGraphKt is a tiny wrapper on top of JSoup.
|
|
|
|
## Current status
|
|
|
|
* Library can extract OpenGraph tags from HTML via a `URL`, `String` or `File` input.
|
|
* Protocol implementation is complete for `og:` tags, but types aren't fully correct (most types currently are `String`).
|
|
* Library should be considered in pre-alpha, use this in production at your own risks :).
|
|
|
|
## Usage
|
|
|
|
See [Main.kt](./demo-remote/src/main/kotlin/fr/lengrand/opengraphktremote/Main.kt) in the `demo-remote` submodule for usage examples.
|
|
|
|
In short :
|
|
|
|
* Add dependency to your Maven / Gradle file. For example :
|
|
|
|
```bash
|
|
implementation("fr.lengrand:opengraphkt:0.1.0")
|
|
```
|
|
|
|
* Enjoy:
|
|
|
|
```kotlin
|
|
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
|
|
```
|
|
|
|
## Author
|
|
|
|
* [Julien Lengrand-Lambert](https://github.com/jlengrand)
|
|
|
|
## License
|
|
|
|
* [The MIT LICENCE. See License](./LICENSE) |