mihon/app/src/main/java/eu/kanade/tachiyomi/util/JsoupExtensions.kt

13 lines
333 B
Kotlin
Raw Normal View History

package eu.kanade.tachiyomi.util
import org.jsoup.nodes.Element
fun Element.selectText(css: String, defaultValue: String? = null): String? {
return select(css).first()?.text() ?: defaultValue
}
fun Element.selectInt(css: String, defaultValue: Int = 0): Int {
return select(css).first()?.text()?.toInt() ?: defaultValue
}