mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-15 05:17:03 +05:30
fix(api): make commentsUrl in search results absolute
This commit is contained in:
parent
432a438815
commit
786f674044
2 changed files with 3 additions and 3 deletions
|
@ -51,7 +51,7 @@ object SearchConverter : Converter<ResponseBody, List<LobstersPost>> {
|
||||||
private fun getCommentsData(elem: Elements): Pair<Int, String> {
|
private fun getCommentsData(elem: Elements): Pair<Int, String> {
|
||||||
val linkElement = elem.select("a")
|
val linkElement = elem.select("a")
|
||||||
val countString = linkElement.text().trimStart().substringBefore(" ")
|
val countString = linkElement.text().trimStart().substringBefore(" ")
|
||||||
val commentsUrl = linkElement.attr("href")
|
val commentsUrl = LobstersApi.BASE_URL + linkElement.attr("href")
|
||||||
return (countString.toIntOrNull() ?: 0) to commentsUrl
|
return (countString.toIntOrNull() ?: 0) to commentsUrl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class SearchApiTest {
|
||||||
url = "https://xenodium.com/chatgpt-visits-the-emacs-doctor/",
|
url = "https://xenodium.com/chatgpt-visits-the-emacs-doctor/",
|
||||||
createdAt = "",
|
createdAt = "",
|
||||||
commentCount = 3,
|
commentCount = 3,
|
||||||
commentsUrl = "/s/gjlsdg/chatgpt_visits_emacs_doctor",
|
commentsUrl = "https://lobste.rs/s/gjlsdg/chatgpt_visits_emacs_doctor",
|
||||||
submitter = User("xenodium", "", null, "/avatars/xenodium-16.png", ""),
|
submitter = User("xenodium", "", null, "/avatars/xenodium-16.png", ""),
|
||||||
tags = listOf("ai", "emacs"),
|
tags = listOf("ai", "emacs"),
|
||||||
description = "",
|
description = "",
|
||||||
|
@ -49,7 +49,7 @@ class SearchApiTest {
|
||||||
url = "https://mstack.nl/blog/20230623-chatgpt-question-pdf-document/",
|
url = "https://mstack.nl/blog/20230623-chatgpt-question-pdf-document/",
|
||||||
createdAt = "",
|
createdAt = "",
|
||||||
commentCount = 0,
|
commentCount = 0,
|
||||||
commentsUrl = "/s/astcqf/implementing_question_answering_system",
|
commentsUrl = "https://lobste.rs/s/astcqf/implementing_question_answering_system",
|
||||||
submitter = User("asteroid", "", null, "/avatars/asteroid-16.png", ""),
|
submitter = User("asteroid", "", null, "/avatars/asteroid-16.png", ""),
|
||||||
tags = listOf("ai"),
|
tags = listOf("ai"),
|
||||||
description = "",
|
description = "",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue