MyReadingManga fix webview block (#6617)

* MyReadingManga fix bug "Not found"

* MyReadingManga fix bug "Not found" in view-mode
This commit is contained in:
Cezary 2024-12-18 03:44:53 +01:00 committed by Draff
parent 8b212ffdcd
commit 2430b18af0
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 19 additions and 4 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'MyReadingManga' extName = 'MyReadingManga'
extClass = '.MyReadingMangaFactory' extClass = '.MyReadingMangaFactory'
extVersionCode = 53 extVersionCode = 54
isNsfw = true isNsfw = true
} }

View File

@ -14,7 +14,6 @@ import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.ParsedHttpSource import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import eu.kanade.tachiyomi.util.asJsoup import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.Headers import okhttp3.Headers
import okhttp3.OkHttpClient
import okhttp3.Request import okhttp3.Request
import okhttp3.Response import okhttp3.Response
import org.jsoup.Jsoup import org.jsoup.Jsoup
@ -29,10 +28,21 @@ open class MyReadingManga(override val lang: String, private val siteLang: Strin
// Basic Info // Basic Info
override val name = "MyReadingManga" override val name = "MyReadingManga"
final override val baseUrl = "https://myreadingmanga.info" final override val baseUrl = "https://myreadingmanga.info"
override val client: OkHttpClient = network.cloudflareClient
override fun headersBuilder(): Headers.Builder = override fun headersBuilder(): Headers.Builder =
super.headersBuilder() super.headersBuilder()
.set("User-Agent", USER_AGENT) .set("User-Agent", USER_AGENT)
.add("X-Requested-With", randomString((1..20).random()))
override val client = network.cloudflareClient.newBuilder()
.addInterceptor { chain ->
val request = chain.request()
val headers = request.headers.newBuilder().apply {
removeAll("X-Requested-With")
}.build()
chain.proceed(request.newBuilder().headers(headers).build())
}
.build()
override val supportsLatest = true override val supportsLatest = true
// Popular - Random // Popular - Random
@ -321,6 +331,11 @@ open class MyReadingManga(override val lang: String, private val siteLang: Strin
} }
companion object { companion object {
private const val USER_AGENT = "Mozilla/5.0 (Linux; Android 13) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.230 Mobile Safari/537.36" private const val USER_AGENT = "Mozilla/5.0 (Linux; Android 13) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Mobile Safari/537.36"
}
private fun randomString(length: Int): String {
val charPool = ('a'..'z') + ('A'..'Z')
return List(length) { charPool.random() }.joinToString("")
} }
} }