Happymh: fix referer for pageListRequest (#2984)

This commit is contained in:
anenasa 2024-05-13 23:18:49 +08:00 committed by Draff
parent 5a229cd8cf
commit af4b442cc0
2 changed files with 4 additions and 2 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Happymh'
extClass = '.Happymh'
extVersionCode = 10
extVersionCode = 11
}
apply from: "$rootDir/common.gradle"

View File

@ -142,10 +142,12 @@ class Happymh : HttpSource(), ConfigurableSource {
override fun pageListRequest(chapter: SChapter): Request {
val url = baseUrl + chapter.url
val comicId = chapter.url.substringAfter("code=").substringBefore("&")
val chapterId = chapter.url.substringAfter("cid=").substringBefore("&")
// Some chapters return 403 without this header
val header = headersBuilder()
.add("X-Requested-With", "XMLHttpRequest")
.set("Referer", url)
.set("Referer", "$baseUrl/reads/$comicId/$chapterId")
.build()
return GET(url, header)
}