mirror of
https://github.com/jlengrand/OpenGraphKt.git
synced 2026-03-10 15:51:39 +00:00
Compare commits
9 Commits
junie-init
...
feat/kover
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
909979974a | ||
|
|
f1544bf599 | ||
|
|
9799f3eb14 | ||
|
|
ee84878ef1 | ||
|
|
ca31ffa8f7 | ||
|
|
45bb727e13 | ||
|
|
bb5919d892 | ||
|
|
d819c2346c | ||
|
|
e4410a7b79 |
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"name": "Java",
|
||||
"image": "mcr.microsoft.com/devcontainers/java:1-21",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/java:1": {
|
||||
"version": "none",
|
||||
"installMaven": "true",
|
||||
"mavenVersion": "3.8.6",
|
||||
"installGradle": "true"
|
||||
}
|
||||
}
|
||||
}
|
||||
22
.github/workflows/junie.yml
vendored
22
.github/workflows/junie.yml
vendored
@@ -1,22 +0,0 @@
|
||||
name: Junie
|
||||
run-name: Junie run ${{ inputs.run_id }}
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
run_id:
|
||||
description: "id of workflow process"
|
||||
required: true
|
||||
workflow_params:
|
||||
description: "stringified params"
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
call-workflow-passing-data:
|
||||
uses: jetbrains-junie/junie-workflows/.github/workflows/ej-issue.yml@main
|
||||
with:
|
||||
workflow_params: ${{ inputs.workflow_params }}
|
||||
35
README.md
35
README.md
@@ -6,44 +6,15 @@
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
|
||||
[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
|
||||
|
||||
* Library can extract OpenGraph tags from HTML via a `URL`, `String` or `File` input.
|
||||
* Current implementation is JVM only, due to the `JSoup` dependency.
|
||||
* 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.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
|
||||
```
|
||||
|
||||
* WIP and absolutely not ready for production usage.
|
||||
* Implementation missing the music, video and audio verticals (see https://ogp.me/)
|
||||
|
||||
## Dependencies
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("fr.lengrand:opengraphkt:0.0.2")
|
||||
implementation("org.jsoup:jsoup:1.20.1")
|
||||
implementation("fr.lengrand:opengraphkt:0.0.1")
|
||||
testImplementation(kotlin("test"))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package fr.lengrand.opengraphktremote
|
||||
|
||||
import fr.lengrand.opengraphkt.Parser
|
||||
import fr.lengrand.opengraphkt.OpenGraphParser
|
||||
import org.jsoup.Jsoup
|
||||
|
||||
/**
|
||||
* This module is only here to verify that the latest Maven Central release can be imported and used as intended.
|
||||
*/
|
||||
fun main() {
|
||||
val parser = Parser()
|
||||
val parser = OpenGraphParser()
|
||||
|
||||
val html = """
|
||||
<!DOCTYPE html>
|
||||
@@ -30,7 +31,8 @@ fun main() {
|
||||
|
||||
println("Parsing from JSoup Document")
|
||||
|
||||
val openGraphDataDoc = parser.parse(html)
|
||||
val doc = Jsoup.parse(html)
|
||||
val openGraphDataDoc = parser.parse(doc)
|
||||
|
||||
println("Title: ${openGraphDataDoc.title}")
|
||||
println("Is valid: ${openGraphDataDoc.isValid()}")
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -4,7 +4,7 @@ pluginManagement {
|
||||
}
|
||||
}
|
||||
plugins {
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.10.0"
|
||||
}
|
||||
rootProject.name = "OpenGraphKt"
|
||||
include("opengraphkt")
|
||||
|
||||
Reference in New Issue
Block a user