DoujinDesu.tv: Fix search query, add author search support (#2326)

master
Draken 6 months ago committed by GitHub
parent 65c61c0c01
commit a39721eaf7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -30,6 +30,7 @@ internal class DoujinDesuParser(context: MangaLoaderContext) :
isMultipleTagsSupported = true, isMultipleTagsSupported = true,
isSearchSupported = true, isSearchSupported = true,
isSearchWithFiltersSupported = true, isSearchWithFiltersSupported = true,
isAuthorSearchSupported = true,
) )
override suspend fun getFilterOptions() = MangaListFilterOptions( override suspend fun getFilterOptions() = MangaListFilterOptions(
@ -49,17 +50,25 @@ internal class DoujinDesuParser(context: MangaLoaderContext) :
override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> { override suspend fun getListPage(page: Int, order: SortOrder, filter: MangaListFilter): List<Manga> {
val url = urlBuilder().apply { val url = urlBuilder().apply {
addPathSegment("manga") when {
addPathSegment("page") page > 1 -> addPathSegments("manga/page/$page/")
addPathSegment("$page/") else -> addPathSegment("manga/")
}
addQueryParameter( addQueryParameter(
"title", "title",
filter.query?.let { filter.query?.let {
filter.query filter.query
}, },
) )
addQueryParameter(
name = "author",
value = filter.author?.let { it
space2plus(it).lowercase()
}
)
addQueryParameter( addQueryParameter(
"order", "order",
when (order) { when (order) {
@ -97,14 +106,6 @@ internal class DoujinDesuParser(context: MangaLoaderContext) :
}, },
) )
} }
// Author
// addQueryParameter("author",
// filter.author?.let {
// filter.author
// }
// )
}.build() }.build()
return webClient.httpGet(url).parseHtml() return webClient.httpGet(url).parseHtml()
@ -204,4 +205,6 @@ internal class DoujinDesuParser(context: MangaLoaderContext) :
) )
} }
} }
private fun space2plus(input: String): String = input.replace(' ', '+')
} }

Loading…
Cancel
Save