NineAnime: fix chapter pages (#18376)
* NineAnime: fix chapter pages Closes #13315 * NineAnime: fix WebView of chapter * NineAnime: Calls moved to pageListParse
This commit is contained in:
parent
52ea2259db
commit
fa085065ea
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'NineAnime'
|
extName = 'NineAnime'
|
||||||
pkgNameSuffix = 'en.nineanime'
|
pkgNameSuffix = 'en.nineanime'
|
||||||
extClass = '.NineAnime'
|
extClass = '.NineAnime'
|
||||||
extVersionCode = 3
|
extVersionCode = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.source.model.Page
|
||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||||
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
|
@ -31,6 +32,10 @@ class NineAnime : ParsedHttpSource() {
|
||||||
.followRedirects(true)
|
.followRedirects(true)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val PAGES_URL = "https://www.glanceoflife.com"
|
||||||
|
}
|
||||||
|
|
||||||
// not necessary for normal usage but added in an attempt to fix usage with VPN (see #3476)
|
// not necessary for normal usage but added in an attempt to fix usage with VPN (see #3476)
|
||||||
override fun headersBuilder(): Headers.Builder = Headers.Builder()
|
override fun headersBuilder(): Headers.Builder = Headers.Builder()
|
||||||
.add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) Gecko/20100101 Firefox/77")
|
.add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) Gecko/20100101 Firefox/77")
|
||||||
|
@ -118,6 +123,10 @@ class NineAnime : ParsedHttpSource() {
|
||||||
return GET(baseUrl + "${manga.url}?waring=1", headers)
|
return GET(baseUrl + "${manga.url}?waring=1", headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getChapterUrl(chapter: SChapter): String {
|
||||||
|
return baseUrl + chapter.url
|
||||||
|
}
|
||||||
|
|
||||||
override fun chapterListSelector() = "ul.detail-chlist li"
|
override fun chapterListSelector() = "ul.detail-chlist li"
|
||||||
|
|
||||||
override fun chapterFromElement(element: Element): SChapter {
|
override fun chapterFromElement(element: Element): SChapter {
|
||||||
|
@ -151,12 +160,21 @@ class NineAnime : ParsedHttpSource() {
|
||||||
// Pages
|
// Pages
|
||||||
|
|
||||||
override fun pageListRequest(chapter: SChapter): Request {
|
override fun pageListRequest(chapter: SChapter): Request {
|
||||||
|
val id: String = chapter.url.substring(chapter.url.lastIndexOf("/", chapter.url.length - 2))
|
||||||
|
|
||||||
val pageListHeaders = headersBuilder().add("Referer", "$baseUrl/manga/").build()
|
val pageListHeaders = headersBuilder().add("Referer", "$baseUrl/manga/").build()
|
||||||
return GET(baseUrl + chapter.url, pageListHeaders)
|
return GET("$PAGES_URL/c/nineanime$id", pageListHeaders)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
val script = document.select("script:containsData(all_imgs_url)").firstOrNull()?.data()
|
val pageListHeaders = headersBuilder().add("Referer", "$baseUrl/manga/").build()
|
||||||
|
|
||||||
|
val scripturl = document.select("script").firstOrNull()?.data()
|
||||||
|
|
||||||
|
val link = scripturl?.split("\"")?.get(1)
|
||||||
|
val pages = client.newCall(GET(PAGES_URL + link, pageListHeaders)).execute().asJsoup()
|
||||||
|
|
||||||
|
val script = pages.select("script:containsData(all_imgs_url)").firstOrNull()?.data()
|
||||||
?: throw Exception("all_imgsurl not found")
|
?: throw Exception("all_imgsurl not found")
|
||||||
return Regex(""""(http.*)",""").findAll(script).mapIndexed { i, mr ->
|
return Regex(""""(http.*)",""").findAll(script).mapIndexed { i, mr ->
|
||||||
Page(i, "", mr.groupValues[1])
|
Page(i, "", mr.groupValues[1])
|
||||||
|
|
Loading…
Reference in New Issue