mirror of
https://github.com/jlengrand/OpenGraphKt.git
synced 2026-03-10 15:51:39 +00:00
Compare commits
14 Commits
v0.0.2
...
junie-init
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
038a0e8d56 | ||
|
|
3b2ba27c80 | ||
|
|
11a22550b7 | ||
|
|
41b06172a9 | ||
|
|
e86142c2f0 | ||
|
|
291f9cd8e1 | ||
|
|
88c9b155f5 | ||
|
|
95069c10a3 | ||
|
|
20f206755c | ||
|
|
42c8accd3d | ||
|
|
4c20ea5dac | ||
|
|
60cc4118d9 | ||
|
|
49dae0504d | ||
|
|
aa34916640 |
12
.devcontainer/devcontainer.json
Normal file
12
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
44
.github/workflows/gradle.yml
vendored
44
.github/workflows/gradle.yml
vendored
@@ -39,19 +39,40 @@ jobs:
|
||||
- name: Build with Gradle Wrapper
|
||||
run: ./gradlew build
|
||||
|
||||
# NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html).
|
||||
# If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version.
|
||||
#
|
||||
# - name: Setup Gradle
|
||||
# uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
|
||||
# with:
|
||||
# gradle-version: '8.9'
|
||||
#
|
||||
# - name: Build with Gradle 8.9
|
||||
# run: gradle build
|
||||
code-coverage:
|
||||
strategy:
|
||||
matrix:
|
||||
java-version: ['23']
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up JDK ${{ matrix.java-version }}
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: ${{ matrix.java-version }}
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
|
||||
|
||||
- name: Build with Gradle Wrapper
|
||||
run: ./gradlew koverXmlReport
|
||||
- name: Archive production artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: all
|
||||
path: .
|
||||
- name: Upload coverage reports
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: opengraphkt/build/reports/kover/report.xml
|
||||
|
||||
dependency-submission:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -68,3 +89,4 @@ jobs:
|
||||
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
|
||||
- name: Generate and submit dependency graph
|
||||
uses: gradle/actions/dependency-submission@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
|
||||
|
||||
|
||||
22
.github/workflows/junie.yml
vendored
Normal file
22
.github/workflows/junie.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
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 }}
|
||||
40
README.md
40
README.md
@@ -1,15 +1,49 @@
|
||||
# OpenGraphKt
|
||||
|
||||
[](https://github.com/simplex-chat/jlengrand/OpenGraphKt/workflows/gradle.yml)
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
|
||||
[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
|
||||
|
||||
* WIP and absolutely not ready for production usage.
|
||||
* Implementation missing the music, video and audio verticals (see https://ogp.me/)
|
||||
* 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
|
||||
```
|
||||
|
||||
|
||||
## Dependencies
|
||||
|
||||
|
||||
@@ -10,8 +10,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.jsoup:jsoup:1.20.1")
|
||||
implementation("fr.lengrand:opengraphkt:0.0.1")
|
||||
implementation("fr.lengrand:opengraphkt:0.0.2")
|
||||
testImplementation(kotlin("test"))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package fr.lengrand.opengraphktremote
|
||||
|
||||
import fr.lengrand.opengraphkt.OpenGraphParser
|
||||
import org.jsoup.Jsoup
|
||||
import fr.lengrand.opengraphkt.Parser
|
||||
|
||||
/**
|
||||
* This module is only here to verify that the latest Maven Central release can be imported and used as intended.
|
||||
*/
|
||||
fun main() {
|
||||
val parser = OpenGraphParser()
|
||||
val parser = Parser()
|
||||
|
||||
val html = """
|
||||
<!DOCTYPE html>
|
||||
@@ -31,8 +30,7 @@ fun main() {
|
||||
|
||||
println("Parsing from JSoup Document")
|
||||
|
||||
val doc = Jsoup.parse(html)
|
||||
val openGraphDataDoc = parser.parse(doc)
|
||||
val openGraphDataDoc = parser.parse(html)
|
||||
|
||||
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-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -3,10 +3,11 @@ import com.vanniktech.maven.publish.SonatypeHost
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("com.vanniktech.maven.publish") version "0.32.0"
|
||||
id("org.jetbrains.kotlinx.kover") version "0.9.1"
|
||||
}
|
||||
|
||||
group = "fr.lengrand"
|
||||
version = "0.0.2"
|
||||
version = "0.0.3-SNAPSHOT"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -69,3 +70,13 @@ mavenPublishing {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
kover {
|
||||
reports {
|
||||
verify {
|
||||
rule {
|
||||
minBound(70)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ pluginManagement {
|
||||
}
|
||||
}
|
||||
plugins {
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.10.0"
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
|
||||
}
|
||||
rootProject.name = "OpenGraphKt"
|
||||
include("opengraphkt")
|
||||
|
||||
Reference in New Issue
Block a user