Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/drewcarlson/ktsoup

A Kotlin multiplatform HTML5 parsing library
https://github.com/drewcarlson/ktsoup

jsoup kotlin kotlin-multiplatform lexbor web-scraping

Last synced: 26 days ago
JSON representation

A Kotlin multiplatform HTML5 parsing library

Awesome Lists containing this project

README

        

# KtSoup

![Maven Central](https://img.shields.io/maven-central/v/org.drewcarlson/ktsoup-core-jvm?label=maven&color=blue)
![](https://github.com/DrewCarlson/KtSoup/workflows/Tests/badge.svg)
[![codecov](https://codecov.io/gh/DrewCarlson/KtSoup/branch/main/graph/badge.svg?token=BTQ8XQOD86)](https://codecov.io/gh/DrewCarlson/KtSoup)

A multiplatform HTML5 parsing library built on [Lexbor](https://github.com/lexbor/lexbor), [Jsoup](https://jsoup.org/), and [node-html-parser](https://github.com/taoqf/node-html-parser).

### [Documentation](https://drewcarlson.github.io/KtSoup/latest/)
### [API Docs](https://drewcarlson.github.io/KtSoup/latest/kdoc/)

## Usage

```kotlin
val documentString = """


Hello World

"""

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

Hello World

}

```

## Download

[![Maven Central](https://img.shields.io/maven-central/v/org.drewcarlson/ktsoup-core-jvm?label=maven&color=blue)](https://search.maven.org/search?q=g:org.drewcarlson%20a:ktsoup-*)
![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/org.drewcarlson/ktsoup-core-jvm?server=https%3A%2F%2Fs01.oss.sonatype.org)

![](https://img.shields.io/static/v1?label=&message=Platforms&color=grey)
![](https://img.shields.io/static/v1?label=&message=Js&color=blue)
![](https://img.shields.io/static/v1?label=&message=Jvm&color=blue)
![](https://img.shields.io/static/v1?label=&message=Linux&color=blue)
![](https://img.shields.io/static/v1?label=&message=macOS&color=blue)
![](https://img.shields.io/static/v1?label=&message=Windows&color=blue)
![](https://img.shields.io/static/v1?label=&message=iOS&color=blue)

```kotlin
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)

```toml
[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](LICENSE).