Skip to content

DrewCarlson/KtSoup

Repository files navigation

KtSoup

Maven Central codecov

A multiplatform HTML5 parsing library built on Lexbor, Jsoup, and node-html-parser.

Usage

val documentString = """
<html>
    <body>
        <div id="test" class="test">Hello World</div>
    </body>
</html>
"""

val document = KtSoupParser.parse(documentString)
document.use { document ->
    val div = document.querySelector("#test")
    println(div.textContent()) // Hello World
    println(div.html())        // <div id="test" class="test">Hello World</div>
}

Download

Maven Central Sonatype Nexus (Snapshots)

repositories {
    mavenCentral()
    // Or snapshots
    maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}

dependencies {
    implementation("org.drewcarlson:ktsoup-core:$VERSION")
    implementation("org.drewcarlson:ktsoup-fs:$VERSION")
    implementation("org.drewcarlson:ktsoup-ktor:$VERSION")
}
Toml (Click to expand)
[versions]
ktsoup = "1.0.0-SNAPSHOT"

[libraries]
ktsoup-core = { module = "org.drewcarlson:ktsoup-core", version.ref = "ktsoup" }
ktsoup-fs = { module = "org.drewcarlson:ktsoup-fs", version.ref = "ktsoup" }
ktsoup-ktor = { module = "org.drewcarlson:ktsoup-ktor", version.ref = "ktsoup" }

License

This project is licensed under Apache-2.0, found in LICENSE.