Manhuadui: new URL, remove decryption and other changes (#5738)
This commit is contained in:
parent
db38a0b4e6
commit
203e4a291b
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'Manhuadui'
|
||||
pkgNameSuffix = 'zh.manhuadui'
|
||||
extClass = '.Manhuadui'
|
||||
extVersionCode = 13
|
||||
extVersionCode = 14
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Page> {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue