aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/FrostParser.kt13
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