Fix chapter images not loading at Tsuki. (#4899)
This commit is contained in:
parent
3e58ce01b8
commit
86ba61b787
src/pt/tsukimangas
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'Tsuki Mangás'
|
extName = 'Tsuki Mangás'
|
||||||
pkgNameSuffix = 'pt.tsukimangas'
|
pkgNameSuffix = 'pt.tsukimangas'
|
||||||
extClass = '.TsukiMangas'
|
extClass = '.TsukiMangas'
|
||||||
extVersionCode = 3
|
extVersionCode = 4
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ class TsukiMangas : HttpSource() {
|
||||||
(if (obj["TITULO"].string.isNotEmpty()) " - " + obj["TITULO"].string else "")
|
(if (obj["TITULO"].string.isNotEmpty()) " - " + obj["TITULO"].string else "")
|
||||||
chapter_number = obj["NUMERO"].string.toFloatOrNull() ?: -1f
|
chapter_number = obj["NUMERO"].string.toFloatOrNull() ?: -1f
|
||||||
scanlator = obj["scans"].array.joinToString { it.obj["NOME"].string }
|
scanlator = obj["scans"].array.joinToString { it.obj["NOME"].string }
|
||||||
date_upload = DATE_FORMATTER.tryParseDate(obj["DATA"].string.substringBefore("T"))
|
date_upload = obj["DATA"].string.substringBefore("T").toDate()
|
||||||
url = "/leitor/$slug/" + obj["NUMERO"].string
|
url = "/leitor/$slug/" + obj["NUMERO"].string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,9 +246,8 @@ class TsukiMangas : HttpSource() {
|
||||||
|
|
||||||
override fun pageListParse(response: Response): List<Page> {
|
override fun pageListParse(response: Response): List<Page> {
|
||||||
val result = response.asJson().array
|
val result = response.asJson().array
|
||||||
val chapterUrl = response.request().header("Referer")!!
|
|
||||||
|
|
||||||
return result.mapIndexed { i, page -> Page(i, chapterUrl, page.obj["IMG"].string) }
|
return result.mapIndexed { i, page -> Page(i, baseUrl, page.obj["IMG"].string) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun fetchImageUrl(page: Page): Observable<String> = Observable.just(page.imageUrl!!)
|
override fun fetchImageUrl(page: Page): Observable<String> = Observable.just(page.imageUrl!!)
|
||||||
|
@ -257,7 +256,7 @@ class TsukiMangas : HttpSource() {
|
||||||
|
|
||||||
override fun imageRequest(page: Page): Request {
|
override fun imageRequest(page: Page): Request {
|
||||||
val newHeaders = headersBuilder()
|
val newHeaders = headersBuilder()
|
||||||
.set("Accept", "image/webp,image/apng,image/*,*/*;q=0.8")
|
.set("Accept", "image/avif,image/webp,image/apng,image/*,*/*;q=0.8")
|
||||||
.set("Referer", page.url)
|
.set("Referer", page.url)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
@ -324,9 +323,9 @@ class TsukiMangas : HttpSource() {
|
||||||
Genre("Zumbi")
|
Genre("Zumbi")
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun SimpleDateFormat.tryParseDate(date: String): Long {
|
private fun String.toDate(): Long {
|
||||||
return try {
|
return try {
|
||||||
parse(date)?.time ?: 0L
|
DATE_FORMATTER.parse(this)?.time ?: 0L
|
||||||
} catch (e: ParseException) {
|
} catch (e: ParseException) {
|
||||||
0L
|
0L
|
||||||
}
|
}
|
||||||
|
@ -336,7 +335,7 @@ class TsukiMangas : HttpSource() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " +
|
private const val USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " +
|
||||||
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36"
|
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36"
|
||||||
|
|
||||||
private val JSON_PARSER by lazy { JsonParser() }
|
private val JSON_PARSER by lazy { JsonParser() }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue