Dm5: Fix image not loading (#1795)

This commit is contained in:
anenasa 2024-03-15 01:48:00 +08:00 committed by Draff
parent 0594d08440
commit 488adf9ba6
2 changed files with 2 additions and 7 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Dm5' extName = 'Dm5'
extClass = '.Dm5' extClass = '.Dm5'
extVersionCode = 1 extVersionCode = 2
isNsfw = true isNsfw = true
} }

View File

@ -185,12 +185,7 @@ class Dm5 : ParsedHttpSource(), ConfigurableSource {
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException() override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException()
override fun imageRequest(page: Page): Request { override fun imageRequest(page: Page): Request {
if (!page.imageUrl!!.contains("pagerdata.ashx")) { val header = headers.newBuilder().add("Referer", baseUrl).build()
return GET(page.imageUrl!!, headers)
}
val referer = page.imageUrl!!.substringBefore("pagerdata.ashx")
val header = headers.newBuilder().add("Referer", referer).build()
return GET(page.imageUrl!!, header) return GET(page.imageUrl!!, header)
} }