From 203e4a291b9f8eff99b4cd47893f1993c04f05e6 Mon Sep 17 00:00:00 2001 From: scb261 <65343233+scb261@users.noreply.github.com> Date: Wed, 10 Feb 2021 00:51:41 +0200 Subject: [PATCH] Manhuadui: new URL, remove decryption and other changes (#5738) --- src/zh/manhuadui/build.gradle | 2 +- .../extension/zh/manhuadui/Manhuadui.kt | 45 ++++--------------- 2 files changed, 9 insertions(+), 38 deletions(-) diff --git a/src/zh/manhuadui/build.gradle b/src/zh/manhuadui/build.gradle index 5f161c37b..3322a9c4a 100644 --- a/src/zh/manhuadui/build.gradle +++ b/src/zh/manhuadui/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Manhuadui' pkgNameSuffix = 'zh.manhuadui' extClass = '.Manhuadui' - extVersionCode = 13 + extVersionCode = 14 libVersion = '1.2' } diff --git a/src/zh/manhuadui/src/eu/kanade/tachiyomi/extension/zh/manhuadui/Manhuadui.kt b/src/zh/manhuadui/src/eu/kanade/tachiyomi/extension/zh/manhuadui/Manhuadui.kt index b592ed0c1..09e94914a 100644 --- a/src/zh/manhuadui/src/eu/kanade/tachiyomi/extension/zh/manhuadui/Manhuadui.kt +++ b/src/zh/manhuadui/src/eu/kanade/tachiyomi/extension/zh/manhuadui/Manhuadui.kt @@ -1,6 +1,5 @@ package eu.kanade.tachiyomi.extension.zh.manhuadui -import android.util.Base64 import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList @@ -14,22 +13,14 @@ import okhttp3.Request import okhttp3.Response import org.jsoup.nodes.Document import org.jsoup.nodes.Element -import javax.crypto.Cipher -import javax.crypto.spec.IvParameterSpec -import javax.crypto.spec.SecretKeySpec class Manhuadui : ParsedHttpSource() { override val name = "漫画堆" - override val baseUrl = "https://www.manhuadai.com" + override val baseUrl = "https://ykmh.com" override val lang = "zh" override val supportsLatest = true - private val imageServer = arrayOf("https://mhcdn.manhuazj.com", "https://res.333dm.com", "https://res02.333dm.com") - - companion object { - private const val DECRYPTION_KEY = "KA58ZAQ321oobbG8" - private const val DECRYPTION_IV = "A1B2C3DEF1G321o8" - } + private val imageServer = arrayOf("https://pic.w1fl.com", "https://mhcdn.manhuazj.com", "https://res.333dm.com", "https://res02.333dm.com") override val client: OkHttpClient = super.client.newBuilder() .followRedirects(true) @@ -100,7 +91,7 @@ class Manhuadui : ParsedHttpSource() { override fun chapterFromElement(element: Element): SChapter { val chapter = SChapter.create() chapter.setUrlWithoutDomain(element.attr("href")) - chapter.name = element.select("span:first-child").text().trim() + chapter.name = element.select("span:nth-child(2)").text().trim() return chapter } @@ -116,40 +107,20 @@ class Manhuadui : ParsedHttpSource() { return super.chapterListParse(response).asReversed() } - // ref: https://jueyue.iteye.com/blog/1830792 - private fun decryptAES(value: String): String? { - return try { - val secretKey = SecretKeySpec(DECRYPTION_KEY.toByteArray(), "AES") - val ivParams = IvParameterSpec(DECRYPTION_IV.toByteArray()) - val cipher = Cipher.getInstance("AES/CBC/PKCS5Padding") - cipher.init(Cipher.DECRYPT_MODE, secretKey, ivParams) - - val code = Base64.decode(value, Base64.NO_WRAP) - - String(cipher.doFinal(code)) - } catch (e: Exception) { - e.printStackTrace() - null - } - } - - private val chapterImagesRegex = Regex("""var chapterImages =\s*"(.*?)";""") - private val imgPathRegex = Regex("""var chapterPath =\s*"(.*?)";""") + private val chapterImagesRegex = Regex("""var chapterImages =\s*\["(.*?)"\];""") private val imgCodeCleanupRegex = Regex("""[\[\]"\\]""") override fun pageListParse(document: Document): List { val html = document.html() val imgCodeStr = chapterImagesRegex.find(html)?.groups?.get(1)?.value ?: throw Exception("imgCodeStr not found") - val imgCode = decryptAES(imgCodeStr) - ?.replace(imgCodeCleanupRegex, "") - ?.replace("%", "%25") - ?: throw Exception("Decryption failed") - val imgPath = imgPathRegex.find(document.html())?.groups?.get(1)?.value ?: throw Exception("imgPath not found") + val imgCode = imgCodeStr + .replace(imgCodeCleanupRegex, "") + .replace("%", "%25") return imgCode.split(",").mapIndexed { i, imgStr -> if (imgStr.startsWith("http://images.dmzj.com")) { Page(i, "", "https://img01.eshanyao.com/showImage.php?url=$imgStr") } else { - Page(i, "", if (imgStr.indexOf("http") == -1) "${imageServer[0]}/$imgPath$imgStr" else imgStr) + Page(i, "", if (imgStr.indexOf("http") == -1) "${imageServer[0]}/$imgStr" else imgStr) } } }