Parser improvements

This commit is contained in:
len
2016-06-20 00:57:29 +02:00
parent 585f7ec17d
commit 143303f7df
3 changed files with 59 additions and 15 deletions

View File

@@ -13,6 +13,10 @@ fun Element.selectInt(css: String, defaultValue: Int = 0): Int {
return select(css).first()?.text()?.toInt() ?: defaultValue
}
fun Element.attrOrText(css: String): String {
return if (css != "text") attr(css) else text()
}
/**
* Returns a Jsoup document for this response.
* @param html the body of the response. Use only if the body was read before calling this method.