Compare commits

..

12 Commits

Author SHA1 Message Date
Julien Lengrand-Lambert
01a0020798 Fix Gender toString bug 2025-06-03 00:26:30 +02:00
Julien Lengrand-Lambert
44f64d3073 More tests 2025-06-03 00:21:50 +02:00
Julien Lengrand-Lambert
2ee8285c52 More tests 2025-06-03 00:17:53 +02:00
Julien Lengrand-Lambert
93543a0d40 Uses OffsetDateTime for video and book too 2025-06-03 00:03:33 +02:00
Julien Lengrand-Lambert
791e3dc3b5 Uses OffsetDateTime for article too 2025-06-02 23:55:58 +02:00
Julien Lengrand-Lambert
f29c82c4f1 Release Date is an offsetDateTime 2025-06-02 23:50:31 +02:00
Julien Lengrand-Lambert
7f43116306 Adds scalable live testing on real data 2025-05-21 22:23:20 +02:00
Julien Lengrand-Lambert
add58d645d Fix typo 2025-05-20 11:44:56 +02:00
Julien Lengrand-Lambert
ea71d996fc Changes URL to an actual URL 2025-05-20 10:26:39 +02:00
Julien Lengrand-Lambert
f5143140a8 Improves types
* Adds missing properties to music album
* Changes gender from String to Enum
2025-05-20 09:54:42 +02:00
Julien Lengrand-Lambert
f43d22b63b Merge branch 'main' into feat/types 2025-05-20 09:13:46 +02:00
Julien Lengrand-Lambert
417c977b0e Minor changes 2025-05-20 09:13:28 +02:00
8 changed files with 18 additions and 60 deletions

View File

@@ -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"
}
}
}

View File

@@ -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 }}

View File

@@ -12,9 +12,7 @@ repositories {
}
dependencies {
implementation("com.fleeksoft.ksoup:ksoup:0.2.4")
implementation("com.fleeksoft.ksoup:ksoup-kotlinx:0.2.4")
implementation("com.fleeksoft.ksoup:ksoup-network:0.2.4")
implementation("org.jsoup:jsoup:1.20.1")
implementation(project(":opengraphkt"))
testImplementation(kotlin("test"))
}

View File

@@ -1,6 +1,6 @@
package fr.lengrand.opengraphkt
import com.fleeksoft.ksoup.Ksoup
import org.jsoup.Jsoup
import java.io.File
import java.net.URI
@@ -25,7 +25,7 @@ fun main() {
println("\nExample 2: Parsing from File")
try {
val resourceUrl = object {}.javaClass.getResource("/example.html")
val resourceFile = File(resourceUrl!!.toURI())
val resourceFile = File(resourceUrl.toURI())
// Parse the file
val openGraphData = parser.parse(resourceFile)
@@ -66,7 +66,7 @@ fun main() {
// Example 4: Parse Open Graph data from a Jsoup Document
println("\nExample 4: Parsing from JSoup Document")
val doc = Ksoup.parse(html)
val doc = Jsoup.parse(html)
val openGraphDataDoc = parser.parse(doc)
println("Title: ${openGraphDataDoc.title}")

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

View File

@@ -7,16 +7,14 @@ plugins {
}
group = "fr.lengrand"
version = "0.1.0"
version = "0.0.3-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
implementation("com.fleeksoft.ksoup:ksoup:0.2.4")
implementation("com.fleeksoft.ksoup:ksoup-kotlinx:0.2.4")
implementation("com.fleeksoft.ksoup:ksoup-network:0.2.4")
implementation("org.jsoup:jsoup:1.20.1")
testImplementation(kotlin("test"))
}

View File

@@ -1,11 +1,8 @@
package fr.lengrand.opengraphkt
import com.fleeksoft.ksoup.Ksoup
import com.fleeksoft.ksoup.network.parseGetRequestBlocking
import com.fleeksoft.ksoup.nodes.Document
import com.fleeksoft.ksoup.parseFile
import com.fleeksoft.ksoup.select.Elements
import kotlinx.coroutines.runBlocking
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import org.jsoup.select.Elements
import java.io.File
import java.net.URI
import java.net.URL
@@ -64,20 +61,21 @@ class Parser {
* Extracts all Open Graph tags from a URL and returns a structured Data object.
*
* @param url The URL to be parsed for Open Graph information.
* @return A Data object containing all extracted Open Graph data.
* @return An Data object containing all extracted Open Graph data.
*/
fun parse(url: URL) : Data {
return parse(Ksoup.parseGetRequestBlocking(url.toString()))
val doc = Jsoup.connect(url.toString()).get()
return parse(doc)
}
/**
* Extracts all Open Graph tags from a raw HTML String and returns a structured Data object.
*
* @param html The raw HTML String to be parsed for Open Graph information.
* @return A Data object containing all extracted Open Graph data.
* @return An Data object containing all extracted Open Graph data.
*/
fun parse(html: String) : Data {
val doc = Ksoup.parse(html)
val doc = Jsoup.parse(html)
return parse(doc)
}
@@ -86,12 +84,10 @@ class Parser {
*
* @param file The file to parse
* @param charset The charset to use for parsing (default is UTF-8)
* @return A Data object containing all extracted Open Graph data.
* @return An Data object containing all extracted Open Graph data.
*/
fun parse(file: File, charset: String = "UTF-8") : Data {
val doc = runBlocking {
Ksoup.parseFile(file, file.absolutePath, charset)
}
val doc = Jsoup.parse(file, charset)
return parse(doc)
}

View File

@@ -11,7 +11,7 @@ repositories {
}
dependencies {
testImplementation(platform("org.junit:junit-bom:5.13.1"))
testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
implementation(kotlin("stdlib-jdk8"))