diff --git a/src/all/myreadingmanga/build.gradle b/src/all/myreadingmanga/build.gradle index ccd048318..95fc07487 100644 --- a/src/all/myreadingmanga/build.gradle +++ b/src/all/myreadingmanga/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'MyReadingManga' extClass = '.MyReadingMangaFactory' - extVersionCode = 53 + extVersionCode = 54 isNsfw = true } diff --git a/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt b/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt index 84497f541..1d03350a5 100644 --- a/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt +++ b/src/all/myreadingmanga/src/eu/kanade/tachiyomi/extension/all/myreadingmanga/MyReadingManga.kt @@ -14,7 +14,6 @@ import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.online.ParsedHttpSource import eu.kanade.tachiyomi.util.asJsoup import okhttp3.Headers -import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.Response import org.jsoup.Jsoup @@ -29,10 +28,21 @@ open class MyReadingManga(override val lang: String, private val siteLang: Strin // Basic Info override val name = "MyReadingManga" final override val baseUrl = "https://myreadingmanga.info" - override val client: OkHttpClient = network.cloudflareClient override fun headersBuilder(): Headers.Builder = super.headersBuilder() .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 // Popular - Random @@ -321,6 +331,11 @@ open class MyReadingManga(override val lang: String, private val siteLang: Strin } 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("") } }