fix NPE and three img error (#17665)
* fix NPE and three img error fix NPE in pageListParse() fix three img error use cookieJar * fix three img error * delete log info
This commit is contained in:
parent
1a23d5e1fd
commit
9fcc8867d3
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'Manwa'
|
extName = 'Manwa'
|
||||||
pkgNameSuffix = 'zh.manwa'
|
pkgNameSuffix = 'zh.manwa'
|
||||||
extClass = '.Manwa'
|
extClass = '.Manwa'
|
||||||
extVersionCode = 2
|
extVersionCode = 3
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import okhttp3.Response
|
||||||
import okhttp3.ResponseBody.Companion.toResponseBody
|
import okhttp3.ResponseBody.Companion.toResponseBody
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
import rx.Observable
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
@ -61,12 +62,12 @@ class Manwa : ParsedHttpSource(), ConfigurableSource {
|
||||||
originalResponse
|
originalResponse
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override val client: OkHttpClient = network.client.newBuilder()
|
override val client: OkHttpClient = network.client.newBuilder()
|
||||||
.addNetworkInterceptor(rewriteOctetStream)
|
.addNetworkInterceptor(rewriteOctetStream)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
// Popular
|
// Popular
|
||||||
|
|
||||||
override fun popularMangaRequest(page: Int) = GET("$baseUrl/rank", headers)
|
override fun popularMangaRequest(page: Int) = GET("$baseUrl/rank", headers)
|
||||||
override fun popularMangaNextPageSelector(): String? = null
|
override fun popularMangaNextPageSelector(): String? = null
|
||||||
override fun popularMangaSelector(): String = "#rankList_2 > a"
|
override fun popularMangaSelector(): String = "#rankList_2 > a"
|
||||||
|
@ -77,7 +78,6 @@ class Manwa : ParsedHttpSource(), ConfigurableSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Latest
|
// Latest
|
||||||
|
|
||||||
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/getUpdate?page=${page * 15 - 15}&date=", headers)
|
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/getUpdate?page=${page * 15 - 15}&date=", headers)
|
||||||
override fun latestUpdatesParse(response: Response): MangasPage {
|
override fun latestUpdatesParse(response: Response): MangasPage {
|
||||||
// Get image host
|
// Get image host
|
||||||
|
@ -142,14 +142,18 @@ class Manwa : ParsedHttpSource(), ConfigurableSource {
|
||||||
return super.chapterListParse(response).reversed()
|
return super.chapterListParse(response).reversed()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pages
|
override fun fetchPageList(chapter: SChapter): Observable<List<Page>> {
|
||||||
|
client.newCall(GET("$baseUrl/static/images/pv.gif")).execute()
|
||||||
|
return super.fetchPageList(chapter)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pages
|
||||||
override fun pageListRequest(chapter: SChapter): Request {
|
override fun pageListRequest(chapter: SChapter): Request {
|
||||||
return GET("$baseUrl${chapter.url}?img_host=${preferences.getString(IMAGE_HOST_KEY, IMAGE_HOST_ENTRY_VALUES[0])}", headers)
|
return GET("$baseUrl${chapter.url}?img_host=${preferences.getString(IMAGE_HOST_KEY, IMAGE_HOST_ENTRY_VALUES[0])}", headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> = mutableListOf<Page>().apply {
|
override fun pageListParse(document: Document): List<Page> = mutableListOf<Page>().apply {
|
||||||
document.select("#cp_img > img[data-r-src]").forEachIndexed { index, it ->
|
document.select("#cp_img > .img-content > img[data-r-src]").forEachIndexed { index, it ->
|
||||||
add(Page(index, "", it.attr("data-r-src")))
|
add(Page(index, "", it.attr("data-r-src")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue