|
|
|
|
@ -35,10 +35,19 @@ internal class NHentaiParser(context: MangaLoaderContext) :
|
|
|
|
|
when (filter) {
|
|
|
|
|
|
|
|
|
|
is MangaListFilter.Search -> {
|
|
|
|
|
// Check if the query is all numbers
|
|
|
|
|
val numericQuery = filter.query.trim()
|
|
|
|
|
if (numericQuery.matches("\\d+".toRegex())) {
|
|
|
|
|
val title = fetchMangaTitle("$this/g/$numericQuery/")
|
|
|
|
|
append("/search/?q=pages:>0 ")
|
|
|
|
|
append(title)
|
|
|
|
|
append("&")
|
|
|
|
|
} else {
|
|
|
|
|
append("/search/?q=pages:>0 ")
|
|
|
|
|
append(filter.query.urlEncoded())
|
|
|
|
|
append("&")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
is MangaListFilter.Advanced -> {
|
|
|
|
|
if (filter.tags.size > 1 || (filter.tags.isNotEmpty() && filter.locale != null)) {
|
|
|
|
|
@ -89,6 +98,11 @@ internal class NHentaiParser(context: MangaLoaderContext) :
|
|
|
|
|
return parseMangaList(webClient.httpGet(url).parseHtml())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private suspend fun fetchMangaTitle(url: String): String {
|
|
|
|
|
val doc = webClient.httpGet(url).parseHtml()
|
|
|
|
|
return doc.selectFirstOrThrow("h1.title").text().trim()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override suspend fun getPageUrl(page: MangaPage): String {
|
|
|
|
|
val doc = webClient.httpGet(page.url.toAbsoluteUrl(domain)).parseHtml()
|
|
|
|
|
val root = doc.body()
|
|
|
|
|
|