opengraphKt

Introduction: A dead simple OpenGraph tags parser for Kotlin
More: Author   ReportBugs   
Tags:

Build Status

A dead simple OpenGraph Tags parser for Kotlin, built using Coroutines and Jsoup.

Usage

The API is exposed through suspending extension functions.

// In a coroutine scope, or inside runBlocking

val url = URL("https://ogp.me/")
val tags = url.getOpenGraphTags()

println("""
Title: ${tags.title}
Description: ${tags.description}
Locale: ${tags.getProperty("locale")}
""")

The getOpenGraphTags() method returns a Tags class which only acts as a wrapper around the underlying Map<String, List<String>> object.

Tags is an inline class, and Inline classes are currently experimental, so make sure you're okay with that before using this library.

Limitations

The library currently only supports the og: namespace.

Contribution

Please feel free to open issues or contribute new features through pull requests.

Download

The library is published on Jitpack. Make sure to add it as a repository to your build.gradle file:

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

And then add the library dependency:

dependencies {
  implementation "com.github.haroldadmin:opengraphKt:(latest-version)"
}

Latest Version

Apps
About Me
Google+: Trinea trinea
GitHub: Trinea