From 972c1e2f37234ea6a104345407c3fa5100df1401 Mon Sep 17 00:00:00 2001 From: Vetle Ledaal <vetle.ledaal@gmail.com> Date: Sun, 24 Jul 2022 23:00:32 +0000 Subject: [PATCH] Koushoku: tweak search, fix details parsing (#12712) * Koushoku: tweak search, fix details parsing Search/filters are now using the AND operator, which is a more sane default than the previous OR operator. Additionally the queries are properly encased in double quotes. Uninitialized manga titles are now properly parsed if they are in a collection, previously it would concatenate all titles together. * * is required for partial search queries * partial search for filters as well --- src/en/koushoku/build.gradle | 2 +- .../kanade/tachiyomi/extension/en/koushoku/Koushoku.kt | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/en/koushoku/build.gradle b/src/en/koushoku/build.gradle index 4a56afc8e..fce2037ad 100644 --- a/src/en/koushoku/build.gradle +++ b/src/en/koushoku/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Koushoku' pkgNameSuffix = 'en.koushoku' extClass = '.Koushoku' - extVersionCode = 7 + extVersionCode = 8 isNsfw = true } diff --git a/src/en/koushoku/src/eu/kanade/tachiyomi/extension/en/koushoku/Koushoku.kt b/src/en/koushoku/src/eu/kanade/tachiyomi/extension/en/koushoku/Koushoku.kt index 0148710a9..2e72022e9 100644 --- a/src/en/koushoku/src/eu/kanade/tachiyomi/extension/en/koushoku/Koushoku.kt +++ b/src/en/koushoku/src/eu/kanade/tachiyomi/extension/en/koushoku/Koushoku.kt @@ -84,7 +84,7 @@ class Koushoku : ParsedHttpSource() { } private fun buildAdvQuery(query: String, filterList: FilterList): String { - val title = if (query.isNotBlank()) "title*:$query " else "" + val title = if (query.isNotBlank()) "title*:\"$query\" " else "" val filters: List<String> = filterList.filterIsInstance<Filter.Text>().map { filter -> if (filter.state.isBlank()) return@map "" val included = mutableListOf<String>() @@ -98,8 +98,8 @@ class Koushoku : ParsedHttpSource() { } } buildString { - if (included.isNotEmpty()) append("$name*:${included.joinToString(",")} ") - if (excluded.isNotEmpty()) append("-$name*:${excluded.joinToString(",")}") + if (included.isNotEmpty()) append("$name&*:\"${included.joinToString(",")}\" ") + if (excluded.isNotEmpty()) append("-$name&*:\"${excluded.joinToString(",")}\"") } } return "$title${ @@ -117,8 +117,8 @@ class Koushoku : ParsedHttpSource() { override fun popularMangaFromElement(element: Element) = latestUpdatesFromElement(element) override fun mangaDetailsParse(document: Document) = SManga.create().apply { - title = document.select(".metadata .title").text() - thumbnail_url = document.select(thumbnailSelector).attr("src") + title = document.selectFirst(".metadata .title").text() + thumbnail_url = document.selectFirst(thumbnailSelector).attr("src") artist = document.select(".metadata .artists a, .metadata .circles a") .joinToString { it.text() } author = artist