HentaiNexus - fix pages (#2563)

HentaiNexus - fix pages
This commit is contained in:
Mike 2020-03-31 21:58:46 -04:00 committed by GitHub
parent b3e0ef430a
commit dd787e9dab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 23 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: HentaiNexus' appName = 'Tachiyomi: HentaiNexus'
pkgNameSuffix = 'en.hentainexus' pkgNameSuffix = 'en.hentainexus'
extClass = '.HentaiNexus' extClass = '.HentaiNexus'
extVersionCode = 1 extVersionCode = 2
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -121,7 +121,7 @@ class HentaiNexus : ParsedHttpSource() {
return manga return manga
} }
fun getDesc(document: Document): String { private fun getDesc(document: Document): String {
val infoElement = document.select("div.column") val infoElement = document.select("div.column")
val stringBuilder = StringBuilder() val stringBuilder = StringBuilder()
val description = infoElement.select("td.viewcolumn:containsOwn(Description) + td").text() val description = infoElement.select("td.viewcolumn:containsOwn(Description) + td").text()
@ -161,13 +161,10 @@ class HentaiNexus : ParsedHttpSource() {
override fun chapterListSelector() = "div.container nav.depict-button-set" override fun chapterListSelector() = "div.container nav.depict-button-set"
override fun chapterFromElement(element: Element): SChapter { override fun chapterFromElement(element: Element): SChapter {
val urlElement = element.select("div.level-item a") return SChapter.create().apply {
val chapter = SChapter.create() url = element.select("div.level-item a").attr("href")
name = "Read Online: Chapter 0"
chapter.url = urlElement.attr("href") }
chapter.name = "Read Online: Chapter 0"
return chapter
} }
override fun pageListRequest(chapter: SChapter): Request { override fun pageListRequest(chapter: SChapter): Request {
@ -178,26 +175,21 @@ class HentaiNexus : ParsedHttpSource() {
} }
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
val pages = mutableListOf<Page>() return document.select("script:containsData(initreader)").first().data()
var script = document.select("script").last().data() .substringAfter("[")
var url = script.substringAfter("[").substringBefore("]") .substringBefore("]")
.replace(Regex("""["\\]"""), "") .replace(Regex("""["\\]"""), "")
.split(",") .split(",")
.mapIndexed { i, image -> Page(i, "", image) }
for (i in 0 until url.size) {
pages.add(Page(i, "", url[i]))
}
return pages
} }
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used") override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
override fun getFilterList() = FilterList( override fun getFilterList() = FilterList(
Filter.Header("Only one filter may be used at a time."), Filter.Header("Only one filter may be used at a time."),
Filter.Separator(), Filter.Separator(),
ArtistFilter(), ArtistFilter(),
TagFilter() TagFilter()
) )
class ArtistFilter : Filter.Text("Search by Artist (must be exact match)") class ArtistFilter : Filter.Text("Search by Artist (must be exact match)")