LectorTmo: Fix images not loading (#4997)

* fix

* Use url.fragment

Co-authored-by: Vetle Ledaal <vetle.ledaal@gmail.com>

* bruh

---------

Co-authored-by: Vetle Ledaal <vetle.ledaal@gmail.com>
This commit is contained in:
bapeey 2024-09-11 00:19:31 -05:00 committed by GitHub
parent 08fab7cd11
commit 332ff9eea4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 9 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'TuMangaOnline / LectorManga'
extClass = '.LectorTmoFactory'
extVersionCode = 1
extVersionCode = 2
isNsfw = true
}

View File

@ -57,13 +57,9 @@ abstract class LectorTmo(
.build()
protected open val imageCDNUrls = arrayOf(
"https://img1.followmanga.com",
"https://img1.biggestchef.com",
"https://img1.indalchef.com",
"https://img1.recipesandcook.com",
"https://img1.cyclingte.com",
"https://img1.japanreader.com",
"https://japanreader.com",
"https://imgtmo.com",
)
private fun OkHttpClient.Builder.rateLimitImageCDNs(hosts: Array<String>, permits: Int, period: Long): OkHttpClient.Builder {
@ -108,7 +104,7 @@ abstract class LectorTmo(
.addInterceptor { chain ->
val request = chain.request()
val url = request.url
if (url.host.contains("japanreader.com")) {
if (url.fragment == "imagereq") {
return@addInterceptor ignoreSslClient.newCall(request).execute()
}
chain.proceed(request)
@ -444,7 +440,7 @@ abstract class LectorTmo(
}
override fun imageRequest(page: Page): Request {
return GET(page.imageUrl!!, tmoHeaders)
return GET(page.imageUrl!! + "#imagereq", tmoHeaders)
}
override fun imageUrlParse(document: Document) = throw UnsupportedOperationException()

View File

@ -83,7 +83,7 @@ class LectorManga : LectorTmo("LectorManga", "https://lectormanga.com", "es", ra
}
override fun imageRequest(page: Page) = GET(
url = page.imageUrl!!,
url = page.imageUrl!! + "#imagereq",
headers = headers.newBuilder()
.set("Referer", page.url.substringBefore("news/"))
.build(),