mirror of
https://github.com/keiyoushi/extensions-source.git
synced 2024-11-25 03:33:24 +01:00
Manwa: Fix page list (#5072)
This commit is contained in:
parent
a5fdb1c192
commit
6c556804ea
@ -1,7 +1,7 @@
|
||||
ext {
|
||||
extName = 'Manwa'
|
||||
extClass = '.Manwa'
|
||||
extVersionCode = 5
|
||||
extVersionCode = 6
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.extension.zh.manwa
|
||||
import android.app.Application
|
||||
import android.content.SharedPreferences
|
||||
import android.net.Uri
|
||||
import android.util.Base64
|
||||
import androidx.preference.CheckBoxPreference
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.PreferenceScreen
|
||||
@ -159,22 +160,19 @@ class Manwa : ParsedHttpSource(), ConfigurableSource {
|
||||
return GET("$baseUrl${chapter.url}?img_host=${preferences.getString(IMAGE_HOST_KEY, IMAGE_HOST_ENTRY_VALUES[0])}", headers)
|
||||
}
|
||||
|
||||
override fun pageListParse(document: Document): List<Page> = mutableListOf<Page>().apply {
|
||||
val cssQuery = "#cp_img > div.img-content > img[data-r-src]"
|
||||
val elements = document.select(cssQuery)
|
||||
if (elements.size == 3) {
|
||||
val darkReader = document.selectFirst("#cp_img p")
|
||||
if (darkReader != null) {
|
||||
if (preferences.getBoolean(AUTO_CLEAR_COOKIE_KEY, false)) {
|
||||
clearCookies()
|
||||
}
|
||||
|
||||
throw Exception(darkReader.text())
|
||||
}
|
||||
}
|
||||
|
||||
elements.forEachIndexed { index, it ->
|
||||
add(Page(index, "", it.attr("data-r-src")))
|
||||
override fun pageListParse(document: Document): List<Page> {
|
||||
val script = document.selectFirst("script:containsData(encryptedPhotos)")!!.data()
|
||||
// key changes every hour
|
||||
val key = script.substringBefore("','enc'").substringAfterLast("'").toByteArray()
|
||||
val encrypted = script.substringAfter("encryptedPhotos = '").substringBefore("'")
|
||||
val decoded = Base64.decode(encrypted, Base64.DEFAULT)
|
||||
val aesKey = SecretKeySpec(key, "AES")
|
||||
val cipher = Cipher.getInstance("AES/CBC/PKCS5Padding")
|
||||
cipher.init(Cipher.DECRYPT_MODE, aesKey, IvParameterSpec(key))
|
||||
val decrypted = String(cipher.doFinal(decoded))
|
||||
val jsonArray = json.parseToJsonElement(decrypted).jsonArray
|
||||
return jsonArray.mapIndexed { index, it ->
|
||||
Page(index, imageUrl = "${it.jsonObject["img_url"]!!.jsonPrimitive.content}?v=20220724")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user