diff --git a/example/src/main/kotlin/SimpleExample.kt b/example/src/main/kotlin/SimpleExample.kt
index f8eeea3..577ffba 100644
--- a/example/src/main/kotlin/SimpleExample.kt
+++ b/example/src/main/kotlin/SimpleExample.kt
@@ -1,5 +1,8 @@
+
import dev.burnoo.ksoup.Kspoon
-import model.FakeProfileLite
+import dev.burnoo.ksoup.annotation.Selector
+import kotlinx.serialization.Serializable
+import model.GithubProfile
private const val HTML_CONTENT = """
burnoo - GitHub
@@ -10,13 +13,25 @@ private const val HTML_CONTENT = """
"""
+@Serializable
+data class FakeGitHubProfile(
+ @Selector("h1", regex = "(.*) - GitHub")
+ val username: String,
+ @Selector("img[id=avatar]", attr = "abs:src")
+ val avatarUrl: String,
+ @Selector("li")
+ val interests: List,
+ @Selector(".pinned-repositories")
+ val pinnedRepositories: List = emptyList(),
+)
+
fun simpleExample() {
val ksoup = Kspoon {
parse = { html -> parse(html, baseUri = "https://github.com/") }
coerceInputValues = true
}
- val profile = ksoup.parse(HTML_CONTENT)
+ val profile = ksoup.parse(HTML_CONTENT)
println("Display name: ${profile.username}")
println("Avatar url: ${profile.avatarUrl}")
diff --git a/example/src/main/kotlin/model/FakeProfileLite.kt b/example/src/main/kotlin/model/FakeProfileLite.kt
deleted file mode 100644
index 8a89ed0..0000000
--- a/example/src/main/kotlin/model/FakeProfileLite.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-package model
-
-import dev.burnoo.ksoup.annotation.Selector
-import kotlinx.serialization.Serializable
-
-@Serializable
-data class FakeProfileLite(
- @Selector("h1", regex = "(.*) - GitHub")
- val username: String,
- @Selector("img[id=avatar]", attr = "abs:src")
- val avatarUrl: String,
- @Selector("li")
- val interests : List,
- @Selector(".pinned-repositories")
- val pinnedRepositories: List = emptyList(),
-)
diff --git a/example/src/main/kotlin/model/GithubProfile.kt b/example/src/main/kotlin/model/GithubProfile.kt
index 40575fe..87ab1cd 100644
--- a/example/src/main/kotlin/model/GithubProfile.kt
+++ b/example/src/main/kotlin/model/GithubProfile.kt
@@ -16,6 +16,7 @@ data class GithubProfile(
data class PinnedRepository(
@Selector("span.repo")
val name: String,
+
@Selector("a.pinned-item-meta", regex = "[0-9]+")
val starNumbers: Int,
)