NineHentai - make details refreshable (#3565)
This commit is contained in:
parent
1357f8b379
commit
4973dd6d61
|
@ -5,7 +5,7 @@ ext {
|
|||
appName = 'Tachiyomi: NineHentai'
|
||||
pkgNameSuffix = 'all.ninehentai'
|
||||
extClass = '.NineHentai'
|
||||
extVersionCode = 6
|
||||
extVersionCode = 7
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -15,18 +15,17 @@ import eu.kanade.tachiyomi.source.model.MangasPage
|
|||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import java.util.Date
|
||||
import okhttp3.MediaType
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.RequestBody
|
||||
import okhttp3.Response
|
||||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
import rx.Observable
|
||||
|
||||
open class NineHentai : ParsedHttpSource() {
|
||||
open class NineHentai : HttpSource() {
|
||||
|
||||
final override val baseUrl = "https://9hentai.com"
|
||||
|
||||
|
@ -131,8 +130,15 @@ open class NineHentai : ParsedHttpSource() {
|
|||
return POST(baseUrl + SEARCH_URL, headers, buildRequestBody(query, page, sort, includedTags, excludedTags))
|
||||
}
|
||||
|
||||
override fun fetchMangaDetails(manga: SManga): Observable<SManga> {
|
||||
return Observable.just(manga)
|
||||
override fun mangaDetailsParse(response: Response): SManga {
|
||||
return SManga.create().apply {
|
||||
response.asJsoup().select("div.card-body").firstOrNull()?.let { info ->
|
||||
title = info.select("h1").text()
|
||||
genre = info.select("div.field-name:contains(Tag:) a.tag").joinToString { it.text() }
|
||||
artist = info.select("div.field-name:contains(Artist:) a.tag").joinToString { it.text() }
|
||||
thumbnail_url = info.select("div#cover v-lazy-image").attr("abs:src")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun pageListRequest(chapter: SChapter): Request {
|
||||
|
@ -181,7 +187,7 @@ open class NineHentai : ParsedHttpSource() {
|
|||
GenreList(NHTags.getTagsList())
|
||||
)
|
||||
|
||||
override fun imageUrlParse(document: Document): String = ""
|
||||
override fun imageUrlParse(response: Response): String = throw Exception("Not Used")
|
||||
|
||||
override fun chapterListRequest(manga: SManga): Request = throw Exception("Not Used")
|
||||
|
||||
|
@ -193,34 +199,6 @@ open class NineHentai : ParsedHttpSource() {
|
|||
|
||||
override fun chapterListParse(response: Response): List<SChapter> = throw Exception("Not Used")
|
||||
|
||||
override fun chapterFromElement(element: Element): SChapter = throw Exception("Not used")
|
||||
|
||||
override fun pageListParse(document: Document) = throw Exception("Not used")
|
||||
|
||||
override fun chapterListSelector(): String = throw Exception("Not used")
|
||||
|
||||
override fun latestUpdatesFromElement(element: Element): SManga = throw Exception("Not used")
|
||||
|
||||
override fun latestUpdatesNextPageSelector(): String? = throw Exception("Not used")
|
||||
|
||||
override fun latestUpdatesSelector(): String = throw Exception("Not used")
|
||||
|
||||
override fun mangaDetailsParse(response: Response): SManga = throw Exception("Not Used")
|
||||
|
||||
override fun mangaDetailsParse(document: Document): SManga = throw Exception("Not used")
|
||||
|
||||
override fun popularMangaFromElement(element: Element): SManga = throw Exception("Not used")
|
||||
|
||||
override fun popularMangaNextPageSelector(): String? = throw Exception("Not used")
|
||||
|
||||
override fun popularMangaSelector(): String = throw Exception("Not used")
|
||||
|
||||
override fun searchMangaFromElement(element: Element): SManga = throw Exception("Not used")
|
||||
|
||||
override fun searchMangaNextPageSelector(): String? = throw Exception("Not used")
|
||||
|
||||
override fun searchMangaSelector(): String = throw Exception("Not used")
|
||||
|
||||
companion object {
|
||||
private val MEDIA_TYPE = MediaType.parse("application/json; charset=utf-8")
|
||||
private const val SEARCH_URL = "/api/getBook"
|
||||
|
|
Loading…
Reference in New Issue