Bugfix/next page henchan ninehentai (#923)

Bugfix/next page henchan ninehentai
This commit is contained in:
Pavka 2019-03-17 14:11:29 +03:00 committed by Carlos
parent 96cca393ec
commit 00470bafb4
4 changed files with 9 additions and 18 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: NineHentai' appName = 'Tachiyomi: NineHentai'
pkgNameSuffix = 'all.ninehentai' pkgNameSuffix = 'all.ninehentai'
extClass = '.NineHentai' extClass = '.NineHentai'
extVersionCode = 1 extVersionCode = 2
libVersion = '1.2' libVersion = '1.2'
} }
dependencies { dependencies {

View File

@ -17,8 +17,10 @@ import rx.Observable
import java.net.URLEncoder import java.net.URLEncoder
import java.util.* import java.util.*
open class NineHentai() : ParsedHttpSource() { open class NineHentai : ParsedHttpSource() {
final override val baseUrl = "https://9hentai.com" final override val baseUrl = "https://9hentai.com"
override val name = "NineHentai" override val name = "NineHentai"
override val lang = "en" override val lang = "en"
@ -46,7 +48,7 @@ open class NineHentai() : ParsedHttpSource() {
override fun popularMangaParse(response: Response): MangasPage { override fun popularMangaParse(response: Response): MangasPage {
val list = getMangaList(response) val list = getMangaList(response)
return MangasPage(list, false) return MangasPage(list, list.isNotEmpty())
} }
override fun fetchLatestUpdates(page: Int): Observable<MangasPage> { override fun fetchLatestUpdates(page: Int): Observable<MangasPage> {
@ -164,18 +166,7 @@ open class NineHentai() : ParsedHttpSource() {
private fun buildRequestBody(searchText: String = "", page: Int = 0, sort: Int = 0): RequestBody { private fun buildRequestBody(searchText: String = "", page: Int = 0, sort: Int = 0): RequestBody {
//in the future switch this to dtos and actually build the json. This is just a work around for //in the future switch this to dtos and actually build the json. This is just a work around for
//initial release, then you can have actual tag searching etc //initial release, then you can have actual tag searching etc
var json = """{"search":{"text":"","page":0,"sort":0,"pages":{"range":[0,2000]},"tag":{"text":"","type":1,"tags":[],"items":{"included":[],"excluded":[]}}}}""" val json = """{"search":{"text":"${URLEncoder.encode(searchText, "UTF-8")}","page":$page,"sort":$sort,"pages":{"range":[0,2000]},"tag":{"text":"","type":1,"tags":[],"items":{"included":[],"excluded":[]}}}}"""
if (searchText.isNotEmpty()) {
val encodedSearch = URLEncoder.encode(searchText, "UTF-8")
json = json.replaceFirst(""""text":""""", """"text":"$encodedSearch"""")
}
if (page > 0) {
json = json.replaceFirst(""""page":0""", """"page":$page""")
}
if (sort > 0) {
json = json.replaceFirst(""""sort":0""", """"sort":$sort""")
}
return RequestBody.create(MEDIA_TYPE, json) return RequestBody.create(MEDIA_TYPE, json)
} }

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: Henchan' appName = 'Tachiyomi: Henchan'
pkgNameSuffix = 'ru.henchan' pkgNameSuffix = 'ru.henchan'
extClass = '.Henchan' extClass = '.Henchan'
extVersionCode = 3 extVersionCode = 4
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -76,11 +76,11 @@ class Henchan : ParsedHttpSource() {
override fun searchMangaFromElement(element: Element): SManga = override fun searchMangaFromElement(element: Element): SManga =
popularMangaFromElement(element) popularMangaFromElement(element)
override fun popularMangaNextPageSelector() = "#pagination > a:nth-child(2)" override fun popularMangaNextPageSelector() = "#pagination > a:contains(Вперед)"
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector() override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
override fun searchMangaNextPageSelector() = ".navigation a#nextlink" override fun searchMangaNextPageSelector() = ""
override fun mangaDetailsParse(document: Document): SManga { override fun mangaDetailsParse(document: Document): SManga {