mirror of
https://github.com/jlengrand/OpenGraphKt.git
synced 2026-03-10 08:31:23 +00:00
committed by
GitHub
parent
5372fab21c
commit
3c0eed60a7
@@ -12,7 +12,9 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.jsoup:jsoup:1.20.1")
|
||||
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(project(":opengraphkt"))
|
||||
testImplementation(kotlin("test"))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package fr.lengrand.opengraphkt
|
||||
|
||||
import org.jsoup.Jsoup
|
||||
import com.fleeksoft.ksoup.Ksoup
|
||||
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 = Jsoup.parse(html)
|
||||
val doc = Ksoup.parse(html)
|
||||
val openGraphDataDoc = parser.parse(doc)
|
||||
|
||||
println("Title: ${openGraphDataDoc.title}")
|
||||
|
||||
Reference in New Issue
Block a user