aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/parsers
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/parsers')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/parsers/MessageParser.kt5
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/parsers/SearchParser.kt13
2 files changed, 9 insertions, 9 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/parsers/MessageParser.kt b/app/src/main/kotlin/com/pitchedapps/frost/parsers/MessageParser.kt
index 7e6ef4bb..9430407d 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/parsers/MessageParser.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/parsers/MessageParser.kt
@@ -1,7 +1,6 @@
package com.pitchedapps.frost.parsers
import com.pitchedapps.frost.facebook.formattedFbUrl
-import com.pitchedapps.frost.facebook.formattedFbUrlCss
import com.pitchedapps.frost.utils.L
import org.apache.commons.text.StringEscapeUtils
import org.jsoup.Jsoup
@@ -65,10 +64,10 @@ private class MessageParserImpl : FrostParserBase<Triple<List<FrostThread>, Fros
L.v("url", a.attr("href"))
return FrostThread(
id = id.toInt(),
- img = pUrl.formattedFbUrlCss,
+ img = pUrl.formattedFbUrl,
title = a.text(),
time = epoch,
- url = a.attr("href").formattedFbUrlCss,
+ url = a.attr("href").formattedFbUrl,
unread = !element.hasClass("acw"),
content = content
)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/parsers/SearchParser.kt b/app/src/main/kotlin/com/pitchedapps/frost/parsers/SearchParser.kt
index 37c09299..908bb153 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/parsers/SearchParser.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/parsers/SearchParser.kt
@@ -2,7 +2,7 @@ package com.pitchedapps.frost.parsers
import ca.allanwang.kau.utils.withMaxLength
import com.pitchedapps.frost.facebook.FbItem
-import com.pitchedapps.frost.facebook.formattedFbUrlCss
+import com.pitchedapps.frost.facebook.formattedFbUrl
import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.frostJsoup
import org.jsoup.Jsoup
@@ -14,7 +14,7 @@ import org.jsoup.nodes.Element
*/
object SearchParser : FrostParser<List<FrostSearch>> by SearchParserImpl() {
fun query(input: String): List<FrostSearch>? {
- val url = "${FbItem.SEARCH.url}?q=$input"
+ val url = "${FbItem._SEARCH.url}?q=${if (input.isNotBlank()) input else "a"}"
L.i(null, "Search Query $url")
return parse(frostJsoup(url))
}
@@ -51,10 +51,10 @@ private class SearchParserImpl : FrostParserBase<List<FrostSearch>>() {
*
* Removed [data-store*=result_id]
*/
- return container.select("a.touchable.primary[href]").filter(Element::hasText).mapNotNull {
- FrostSearch(it.attr("href").formattedFbUrlCss,
- it.select(".title").first()?.text() ?: "",
- it.select(".subtitle").first()?.ownText())
+ return container.select("a.touchable[href]").filter(Element::hasText).map {
+ FrostSearch(it.attr("href").formattedFbUrl,
+ it.select("._uoi").first()?.text() ?: "",
+ it.select("._1tcc").first()?.text())
}.filter { it.title.isNotBlank() }
}
@@ -62,6 +62,7 @@ private class SearchParserImpl : FrostParserBase<List<FrostSearch>>() {
override fun textToDoc(text: String): Document? = Jsoup.parse(text)
override fun debugImpl(data: List<FrostSearch>, result: MutableList<String>) {
+ result.add("Has size ${data.size}")
result.addAll(data.map(FrostSearch::toString))
}