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
This commit is contained in:
Vetle Ledaal 2022-07-24 23:00:32 +00:00 committed by GitHub
parent 996513d0e3
commit 972c1e2f37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Koushoku'
pkgNameSuffix = 'en.koushoku'
extClass = '.Koushoku'
extVersionCode = 7
extVersionCode = 8
isNsfw = true
}

View File

@ -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