MangaRaw: fix page list (#14829)

This commit is contained in:
stevenyomi 2023-01-09 18:27:44 +08:00 committed by GitHub
parent b5b07b7a23
commit 7d7552af06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 11 deletions

View File

@ -1,9 +1,9 @@
package eu.kanade.tachiyomi.extension.ja.manga9co
import android.app.Application
import android.util.Base64
import androidx.preference.ListPreference
import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.multisrc.mangaraw.ImageListParser
import eu.kanade.tachiyomi.multisrc.mangaraw.MangaRawTheme
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.ConfigurableSource
@ -72,12 +72,8 @@ class MangaRaw : MangaRawTheme("MangaRaw", ""), ConfigurableSource {
override fun pageListParse(response: Response): List<Page> {
if (!isPagesShuffled) return super.pageListParse(response)
val html = response.body!!.string()
val startText = "let ads = '"
val startIndex = html.indexOf(startText) + startText.length
val endIndex = html.indexOf('\'', startIndex)
val base64 = html.substring(startIndex, endIndex)
val decoded = String(Base64.decode(base64, Base64.DEFAULT))
return decoded.split(",").mapIndexed { index, imageUrl ->
val imageList = ImageListParser(html, 32).getImageList() ?: return emptyList()
return imageList.mapIndexed { index, imageUrl ->
Page(index, imageUrl = imageUrl)
}
}

View File

@ -27,8 +27,8 @@ internal fun getSelectors(mirrorIndex: Int) = when (mirrorIndex) {
internal fun needUrlSanitize(mirrorIndex: Int) = mirrorIndex == 2
internal fun isPagesShuffled(mirrorIndex: Int) = when (mirrorIndex) {
1, 3 -> true
else -> false
0 -> false
else -> true
}
internal val mangaSlugRegex = Regex("""^/mz[a-z]{4}-""")

View File

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.extension.ja.mangarawru
import eu.kanade.tachiyomi.multisrc.mangaraw.ImageListParser
import eu.kanade.tachiyomi.multisrc.mangaraw.MangaRawTheme
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.FilterList

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.extension.ja.mangarawru
package eu.kanade.tachiyomi.multisrc.mangaraw
import kotlin.math.pow

View File

@ -12,7 +12,7 @@ class MangaRawGenerator : ThemeSourceGenerator {
override val sources = listOf(
SingleLang("SyoSetu", "https://syosetu.top", "ja"),
SingleLang("MangaRaw", "https://manga1001.in", "ja", pkgName = "manga9co", overrideVersionCode = 1),
SingleLang("MangaRaw", "https://manga1001.in", "ja", pkgName = "manga9co", overrideVersionCode = 2),
SingleLang("MangaRawRU", "https://mangaraw.ru", "ja", overrideVersionCode = 1),
)