Bilimanga: fixed some chapter page response encoding parsing errors (#9609)
* fixed some chapter page response encoding parsing errors * modify
This commit is contained in:
parent
aedd777371
commit
b747b55681
@ -1,7 +1,7 @@
|
|||||||
ext {
|
ext {
|
||||||
extName = 'BiliManga'
|
extName = 'BiliManga'
|
||||||
extClass = '.BiliManga'
|
extClass = '.BiliManga'
|
||||||
extVersionCode = 1
|
extVersionCode = 2
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,8 +86,7 @@ class BiliManga : HttpSource(), ConfigurableSource {
|
|||||||
|
|
||||||
// Latest Page
|
// Latest Page
|
||||||
|
|
||||||
override fun latestUpdatesRequest(page: Int) =
|
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/top/lastupdate/$page.html", headers)
|
||||||
GET("$baseUrl/top/lastupdate/$page.html", headers)
|
|
||||||
|
|
||||||
override fun latestUpdatesParse(response: Response) = popularMangaParse(response)
|
override fun latestUpdatesParse(response: Response) = popularMangaParse(response)
|
||||||
|
|
||||||
@ -119,11 +118,13 @@ class BiliManga : HttpSource(), ConfigurableSource {
|
|||||||
val doc = response.asJsoup()
|
val doc = response.asJsoup()
|
||||||
val meta = doc.selectFirst(".book-meta")!!.text().split("|")
|
val meta = doc.selectFirst(".book-meta")!!.text().split("|")
|
||||||
val extra = meta.filterNot(META_REGEX::containsMatchIn)
|
val extra = meta.filterNot(META_REGEX::containsMatchIn)
|
||||||
val backupname = doc.selectFirst(".backupname")?.let { "漫畫別名:${it.text()}\n\n" }
|
val backupname = doc.selectFirst(".backupname")?.let {
|
||||||
|
"\n\n漫畫別名:\n• ${it.text().split("、").joinToString("\n• ")}"
|
||||||
|
}
|
||||||
url = doc.location()
|
url = doc.location()
|
||||||
title = doc.selectFirst(".book-title")!!.text()
|
title = doc.selectFirst(".book-title")!!.text()
|
||||||
thumbnail_url = doc.selectFirst(".book-cover")!!.attr("src")
|
thumbnail_url = doc.selectFirst(".book-cover")!!.attr("src")
|
||||||
description = backupname + doc.selectFirst("#bookSummary")?.text()
|
description = doc.selectFirst("#bookSummary")?.text() + backupname
|
||||||
artist = doc.selectFirst(".authorname")?.text()
|
artist = doc.selectFirst(".authorname")?.text()
|
||||||
author = doc.selectFirst(".illname")?.text() ?: artist
|
author = doc.selectFirst(".illname")?.text() ?: artist
|
||||||
status = when (meta.firstOrNull()) {
|
status = when (meta.firstOrNull()) {
|
||||||
@ -137,19 +138,22 @@ class BiliManga : HttpSource(), ConfigurableSource {
|
|||||||
|
|
||||||
// Catalog Page
|
// Catalog Page
|
||||||
|
|
||||||
override fun chapterListRequest(manga: SManga) =
|
override fun chapterListRequest(manga: SManga) = GET("$baseUrl/read/${manga.id}/catalog", headers)
|
||||||
GET("$baseUrl/read/${manga.id}/catalog", headers)
|
|
||||||
|
|
||||||
override fun chapterListParse(response: Response) = response.asJsoup().let {
|
override fun chapterListParse(response: Response) = response.asJsoup().let {
|
||||||
val info = it.selectFirst(".chapter-sub-title")!!.text()
|
val info = it.selectFirst(".chapter-sub-title")!!.text()
|
||||||
val date = DATE_FORMAT.tryParse(DATE_REGEX.find(info)?.value)
|
val date = DATE_FORMAT.tryParse(DATE_REGEX.find(info)?.value)
|
||||||
val elements = it.select(".chapter-li-a")
|
it.select(".catalog-volume").flatMap { v ->
|
||||||
elements.mapIndexed { i, e ->
|
val chapterBar = v.selectFirst(".chapter-bar")!!.text().toHalfWidthDigits()
|
||||||
|
val chapters = v.select(".chapter-li-a")
|
||||||
|
chapters.mapIndexed { i, e ->
|
||||||
val url = e.absUrl("href").takeUnless("javascript:cid(1)"::equals)
|
val url = e.absUrl("href").takeUnless("javascript:cid(1)"::equals)
|
||||||
SChapter.create().apply {
|
SChapter.create().apply {
|
||||||
name = e.text().toHalfWidthDigits()
|
name = e.text().toHalfWidthDigits()
|
||||||
date_upload = date
|
date_upload = date
|
||||||
setUrlWithoutDomain(url ?: getChapterUrlByContext(i, elements))
|
scanlator = chapterBar
|
||||||
|
setUrlWithoutDomain(url ?: getChapterUrlByContext(i, chapters))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.reversed()
|
}.reversed()
|
||||||
}
|
}
|
||||||
@ -160,7 +164,7 @@ class BiliManga : HttpSource(), ConfigurableSource {
|
|||||||
val images = it.select(".imagecontent")
|
val images = it.select(".imagecontent")
|
||||||
check(images.size > 0) {
|
check(images.size > 0) {
|
||||||
it.selectFirst("#acontentz")?.let { e ->
|
it.selectFirst("#acontentz")?.let { e ->
|
||||||
if ("電腦端" in e.text()) "章節不支持桌面電腦端瀏覽器顯示" else "漫畫可能已下架或需要登錄查看"
|
if ("電腦端" in e.text()) "不支持電腦端查看,請在高級設置中更換移動端UA標識" else "漫畫可能已下架或需要登錄查看"
|
||||||
} ?: "章节鏈接错误"
|
} ?: "章节鏈接错误"
|
||||||
}
|
}
|
||||||
images.mapIndexed { i, image ->
|
images.mapIndexed { i, image ->
|
||||||
|
@ -3,8 +3,6 @@ package eu.kanade.tachiyomi.extension.zh.bilimanga
|
|||||||
import okhttp3.HttpUrl
|
import okhttp3.HttpUrl
|
||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import okio.GzipSource
|
|
||||||
import okio.buffer
|
|
||||||
|
|
||||||
class MangaInterceptor : Interceptor {
|
class MangaInterceptor : Interceptor {
|
||||||
|
|
||||||
@ -30,14 +28,13 @@ class MangaInterceptor : Interceptor {
|
|||||||
"/read/${groups?.get(1)?.value}/${groups?.get(2)?.value?.toInt()?.minus(1)}.html"
|
"/read/${groups?.get(1)?.value}/${groups?.get(2)?.value?.toInt()?.minus(1)}.html"
|
||||||
}
|
}
|
||||||
else -> "/read/0/0.html"
|
else -> "/read/0/0.html"
|
||||||
} + "?predict"
|
}
|
||||||
|
|
||||||
override fun intercept(chain: Interceptor.Chain): Response {
|
override fun intercept(chain: Interceptor.Chain): Response {
|
||||||
val origin = chain.request()
|
val origin = chain.request()
|
||||||
regexOf(origin.url.fragment)?.let {
|
regexOf(origin.url.fragment)?.let {
|
||||||
val response = chain.proceed(origin)
|
val response = chain.proceed(origin.newBuilder().removeHeader("Accept-Encoding").build())
|
||||||
val html = GzipSource(response.body.source()).buffer().readUtf8()
|
val url = it.find(response.body.string())?.groups?.get(1)?.value
|
||||||
val url = it.find(html)?.groups?.get(1)?.value?.plus("?match")
|
|
||||||
return response.newBuilder().code(302)
|
return response.newBuilder().code(302)
|
||||||
.header("Location", url ?: predictUrlByContext(origin.url)).build()
|
.header("Location", url ?: predictUrlByContext(origin.url)).build()
|
||||||
}
|
}
|
||||||
|
@ -11,17 +11,17 @@ fun preferencesInternal(context: Context) = arrayOf(
|
|||||||
title = "熱門漫畫顯示内容"
|
title = "熱門漫畫顯示内容"
|
||||||
summary = "%s"
|
summary = "%s"
|
||||||
entries = arrayOf(
|
entries = arrayOf(
|
||||||
"月点击榜",
|
"月點擊榜",
|
||||||
"周点击榜",
|
"周點擊榜",
|
||||||
"月推荐榜",
|
"月推薦榜",
|
||||||
"周推荐榜",
|
"周推薦榜",
|
||||||
"月鲜花榜",
|
"月鮮花榜",
|
||||||
"周鲜花榜",
|
"周鮮花榜",
|
||||||
"月鸡蛋榜",
|
"月雞蛋榜",
|
||||||
"周鸡蛋榜",
|
"周雞蛋榜",
|
||||||
"最新入库",
|
"最新入庫",
|
||||||
"收藏榜",
|
"收藏榜",
|
||||||
"新书榜",
|
"新書榜",
|
||||||
)
|
)
|
||||||
entryValues = arrayOf(
|
entryValues = arrayOf(
|
||||||
"/top/monthvisit/%d.html",
|
"/top/monthvisit/%d.html",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user