diff options
author | Allan Wang <me@allanwang.ca> | 2018-09-27 20:36:01 -0400 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2018-09-27 20:36:01 -0400 |
commit | 2bc366f8f4501a93d773c8a6d8ad103d05cce08d (patch) | |
tree | 01ec5b4a22de310fe28233d598aaea59f3914ec8 /app/src | |
parent | 2e22f2ae6a963a2e00dc4b50b4a308c80ebe68e2 (diff) | |
download | frost-2bc366f8f4501a93d773c8a6d8ad103d05cce08d.tar.gz frost-2bc366f8f4501a93d773c8a6d8ad103d05cce08d.tar.bz2 frost-2bc366f8f4501a93d773c8a6d8ad103d05cce08d.zip |
Fix method signatures
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/FrostParser.kt | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/FrostParser.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/FrostParser.kt index 90d2a214..3d5c5bce 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/FrostParser.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/FrostParser.kt @@ -104,22 +104,19 @@ internal abstract class FrostParserBase<out T : Any>(private val redirectToText: protected abstract fun parseImpl(doc: Document): T? - // protected abstract fun parse(doc: Document): T? - /** * Attempts to find inner <i> element with some style containing a url * Returns the formatted url, or an empty string if nothing was found */ - protected fun Element.getInnerImgStyle() = + protected fun Element.getInnerImgStyle(): String? = select("i.img[style*=url]").getStyleUrl() - protected fun Elements.getStyleUrl() = + protected fun Elements.getStyleUrl(): String? = FB_CSS_URL_MATCHER.find(attr("style"))[1]?.formattedFbUrl - protected open fun textToDoc(text: String): Document = if (!redirectToText) - Jsoup.parse(text) - else - throw RuntimeException("${this::class.java.simpleName} requires text redirect but did not implement textToDoc") + protected open fun textToDoc(text: String): Document? = + if (!redirectToText) Jsoup.parse(text) + else throw RuntimeException("${this::class.java.simpleName} requires text redirect but did not implement textToDoc") protected fun parseLink(element: Element?): FrostLink? { val a = element?.getElementsByTag("a")?.first() ?: return null |