Happymh: Fix page list and chapter WebView (#6114)
This commit is contained in:
parent
3e2dee3690
commit
8271cbd637
|
@ -1,7 +1,7 @@
|
||||||
ext {
|
ext {
|
||||||
extName = 'Happymh'
|
extName = 'Happymh'
|
||||||
extClass = '.Happymh'
|
extClass = '.Happymh'
|
||||||
extVersionCode = 12
|
extVersionCode = 13
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -151,22 +151,30 @@ class Happymh : HttpSource(), ConfigurableSource {
|
||||||
return json.decodeFromString<ChapterListDto>(script).chapterList.map {
|
return json.decodeFromString<ChapterListDto>(script).chapterList.map {
|
||||||
SChapter.create().apply {
|
SChapter.create().apply {
|
||||||
val chapterId = it.id
|
val chapterId = it.id
|
||||||
url = "/v2.0/apis/manga/read?code=$comicId&cid=$chapterId&v=v2.13"
|
url = "/reads/$comicId/$chapterId"
|
||||||
name = it.chapterName
|
name = it.chapterName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getChapterUrl(chapter: SChapter): String {
|
||||||
|
return baseUrl + chapter.url
|
||||||
|
}
|
||||||
|
|
||||||
// Pages
|
// Pages
|
||||||
|
|
||||||
override fun pageListRequest(chapter: SChapter): Request {
|
override fun pageListRequest(chapter: SChapter): Request {
|
||||||
val url = baseUrl + chapter.url
|
if (chapter.url.startsWith("/v2.0/apis/manga/read")) {
|
||||||
val comicId = chapter.url.substringAfter("code=").substringBefore("&")
|
// Old format is detected
|
||||||
val chapterId = chapter.url.substringAfter("cid=").substringBefore("&")
|
throw Exception("请刷新章节列表")
|
||||||
|
}
|
||||||
|
val comicId = chapter.url.substringAfter("/reads/").substringBefore("/")
|
||||||
|
val chapterId = chapter.url.substringAfterLast("/")
|
||||||
|
val url = "$baseUrl/v2.0/apis/manga/read?code=$comicId&cid=$chapterId&v=v3.1302723"
|
||||||
// Some chapters return 403 without this header
|
// Some chapters return 403 without this header
|
||||||
val header = headersBuilder()
|
val header = headersBuilder()
|
||||||
.add("X-Requested-With", "XMLHttpRequest")
|
.add("X-Requested-With", "XMLHttpRequest")
|
||||||
.set("Referer", "$baseUrl/reads/$comicId/$chapterId")
|
.set("Referer", baseUrl + chapter.url)
|
||||||
.build()
|
.build()
|
||||||
return GET(url, header)
|
return GET(url, header)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue