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 Draff
parent 96d97d7275
commit af8a367cfa
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
3 changed files with 5 additions and 9 deletions

View File

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

View File

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