Adds usage to README

This commit is contained in:
Julien Lengrand-Lambert
2025-05-19 13:52:04 +02:00
parent 88c9b155f5
commit 291f9cd8e1

View File

@@ -9,7 +9,7 @@
[OpenGraphKt](https://github.com/jlengrand/OpenGraphKt) is a minimalist Kotlin library to work with the [Open Graph tags](https://ogp.me/) protocol. [OpenGraphKt](https://github.com/jlengrand/OpenGraphKt) is a minimalist Kotlin library to work with the [Open Graph tags](https://ogp.me/) protocol.
OpenGraphKt is a tiny wrapper on top of JSoup. OpenGraphKt is a tiny wrapper on top of JSoup.
## Current status ## Current status
@@ -18,6 +18,32 @@ OpenGraphKt is a tiny wrapper on top of JSoup.
* Protocol implementation is complete for `og:` tags, but types aren't fully correct (most types currently are `String`). * 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 :). * 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.0.2")
```
* 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
```
## Dependencies ## Dependencies
- [JSoup](https://jsoup.org/) - [JSoup](https://jsoup.org/)