Luratoon: add referer (#2799)
* add referer * move fix to base theme * add location to non zipped images
This commit is contained in:
parent
a848d1bb2e
commit
cfc2fcbf4b
|
@ -2,7 +2,7 @@ plugins {
|
|||
id("lib-multisrc")
|
||||
}
|
||||
|
||||
baseVersionCode = 4
|
||||
baseVersionCode = 5
|
||||
|
||||
dependencies {
|
||||
compileOnly("com.github.tachiyomiorg:image-decoder:e08e9be535")
|
||||
|
|
|
@ -156,18 +156,25 @@ abstract class PeachScan(
|
|||
override fun pageListParse(document: Document): List<Page> {
|
||||
val scriptElement = document.selectFirst("script:containsData(const urls =[)")
|
||||
?: return document.select("#imageContainer img").mapIndexed { i, it ->
|
||||
Page(i, imageUrl = it.attr("abs:src"))
|
||||
Page(i, document.location(), it.attr("abs:src"))
|
||||
}
|
||||
|
||||
val urls = scriptElement.html().substringAfter("const urls =[").substringBefore("];")
|
||||
|
||||
return urls.split(",").mapIndexed { i, it ->
|
||||
Page(i, imageUrl = baseUrl + it.trim().removeSurrounding("'") + "#page")
|
||||
Page(i, document.location(), baseUrl + it.trim().removeSurrounding("'") + "#page")
|
||||
}
|
||||
}
|
||||
|
||||
override fun imageUrlParse(document: Document) = throw UnsupportedOperationException()
|
||||
|
||||
override fun imageRequest(page: Page): Request {
|
||||
val imgHeaders = headersBuilder()
|
||||
.add("Referer", page.url)
|
||||
.build()
|
||||
return GET(page.imageUrl!!, imgHeaders)
|
||||
}
|
||||
|
||||
private val dataUriRegex = Regex("""base64,([0-9a-zA-Z/+=\s]+)""")
|
||||
|
||||
private fun zipImageInterceptor(chain: Interceptor.Chain): Response {
|
||||
|
|
Loading…
Reference in New Issue