mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 23:21:49 +01:00
parent
772bef05fc
commit
ae60e8cbd5
@ -28,16 +28,21 @@ class Mangachan : ParsedHttpSource() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
|
var pageNum = 1
|
||||||
|
when {
|
||||||
|
page < 1 -> pageNum = 1
|
||||||
|
page >= 1 -> pageNum = page
|
||||||
|
}
|
||||||
val url = if (query.isNotEmpty()) {
|
val url = if (query.isNotEmpty()) {
|
||||||
"$baseUrl/?do=search&subaction=search&story=$query"
|
"$baseUrl/?do=search&subaction=search&story=$query&search_start=$pageNum"
|
||||||
} else {
|
} else {
|
||||||
val filt = filters.filterIsInstance<Genre>().filter { !it.isIgnored() }
|
val filt = filters.filterIsInstance<Genre>().filter { !it.isIgnored() }
|
||||||
if (filt.isNotEmpty()) {
|
if (filt.isNotEmpty()) {
|
||||||
var genres = ""
|
var genres = ""
|
||||||
filt.forEach { genres += (if (it.isExcluded()) "-" else "") + it.id + '+' }
|
filt.forEach { genres += (if (it.isExcluded()) "-" else "") + it.id + '+' }
|
||||||
"$baseUrl/tags/${genres.dropLast(1)}"
|
"$baseUrl/tags/${genres.dropLast(1)}?offset=${20 * (pageNum - 1)}"
|
||||||
} else {
|
} else {
|
||||||
"$baseUrl/?do=search&subaction=search&story=$query"
|
"$baseUrl/?do=search&subaction=search&story=$query&search_start=$pageNum"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return GET(url, headers)
|
return GET(url, headers)
|
||||||
@ -85,28 +90,29 @@ class Mangachan : ParsedHttpSource() {
|
|||||||
|
|
||||||
override fun searchMangaParse(response: Response): MangasPage {
|
override fun searchMangaParse(response: Response): MangasPage {
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
|
var hasNextPage = false
|
||||||
|
|
||||||
val mangas = document.select(searchMangaSelector()).map { element ->
|
val mangas = document.select(searchMangaSelector()).map { element ->
|
||||||
searchMangaFromElement(element)
|
searchMangaFromElement(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME
|
val nextSearchPage = document.select(searchMangaNextPageSelector())
|
||||||
// val allIgnore = filters.all { it.state == Filter.TriState.STATE_IGNORE }
|
if (nextSearchPage.isNotEmpty()) {
|
||||||
// searchMangaNextPageSelector().let { selector ->
|
val query = document.select("input#searchinput").first().attr("value")
|
||||||
// if (page.nextPageUrl.isNullOrEmpty() && allIgnore) {
|
val pageNum = nextSearchPage.let { selector ->
|
||||||
// val onClick = document.select(selector).first()?.attr("onclick")
|
val onClick = selector.attr("onclick")
|
||||||
// val pageNum = onClick?.substring(23, onClick.indexOf("); return(false)"))
|
onClick?.split("""\\d+""")
|
||||||
// page.nextPageUrl = searchMangaInitialUrl(query, emptyList()) + "&search_start=" + pageNum
|
}
|
||||||
// }
|
nextSearchPage.attr("href", "$baseUrl/?do=search&subaction=search&story=$query&search_start=$pageNum")
|
||||||
// }
|
hasNextPage = true
|
||||||
//
|
}
|
||||||
// searchGenresNextPageSelector().let { selector ->
|
|
||||||
// if (page.nextPageUrl.isNullOrEmpty() && !allIgnore) {
|
|
||||||
// val url = document.select(selector).first()?.attr("href")
|
|
||||||
// page.nextPageUrl = searchMangaInitialUrl(query, filters) + url
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
return MangasPage(mangas, false)
|
val nextGenresPage = document.select(searchGenresNextPageSelector())
|
||||||
|
if (nextGenresPage.isNotEmpty()) {
|
||||||
|
hasNextPage = true
|
||||||
|
}
|
||||||
|
|
||||||
|
return MangasPage(mangas, hasNextPage)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mangaDetailsParse(document: Document): SManga {
|
override fun mangaDetailsParse(document: Document): SManga {
|
||||||
|
Loading…
Reference in New Issue
Block a user