diff --git a/multisrc/overrides/mangathemesia/constellarscans/src/ConstellarScans.kt b/multisrc/overrides/mangathemesia/constellarscans/src/ConstellarScans.kt index fbdfb6ee8..0a29f7c32 100644 --- a/multisrc/overrides/mangathemesia/constellarscans/src/ConstellarScans.kt +++ b/multisrc/overrides/mangathemesia/constellarscans/src/ConstellarScans.kt @@ -30,7 +30,7 @@ import java.security.MessageDigest class ConstellarScans : MangaThemesia("Constellar Scans", "https://constellarscans.com", "en") { override val client = super.client.newBuilder() - .rateLimit(1, 2) + .rateLimit(1, 3) .addInterceptor { chain -> val response = chain.proceed(chain.request()) @@ -97,24 +97,22 @@ class ConstellarScans : MangaThemesia("Constellar Scans", "https://constellarsca ?: return super.pageListParse(document) val descrambledData = descrambleString(tsData).trim() - val match = DESCRAMBLING_KEY_RE.find(descrambledData)?.value - if (match != null) { - Log.d("constellarscans", "device-limited chapter, key: $match") - return decodeDeviceLimitedChapter(match) - } - - val imageListJson = - JSON_IMAGE_LIST_REGEX.find(descrambledData)?.groupValues?.get(1).orEmpty() - val imageList = try { - json.parseToJsonElement(imageListJson).jsonArray + // check if the object can be parsed with JSON, else assume it is encrypted + // + // done because constellarscans have shit code and would sometimes give us an invalid key + // for no reason + return try { + val parsedTsData = json.parseToJsonElement(descrambledData).jsonObject + val imageList = parsedTsData["sources"]!!.jsonArray[0].jsonObject["images"]!!.jsonArray + imageList.mapIndexed { idx, it -> + Page(idx, imageUrl = it.jsonPrimitive.content) + } } catch (_: IllegalArgumentException) { - emptyList() + val match = DESCRAMBLING_KEY_RE.find(descrambledData)?.value + ?: throw Exception("Did not receive valid decryption key. Try opening the chapter again.") + Log.d("constellarscans", "device-limited chapter: $match") + decodeDeviceLimitedChapter(match) } - val scriptPages = imageList.mapIndexed { i, jsonEl -> - Page(i, imageUrl = jsonEl.jsonPrimitive.content) - } - - return scriptPages } override fun imageRequest(page: Page): Request = super.imageRequest(page).newBuilder() diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesia.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesia.kt index f5274f733..d30acd7b8 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesia.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesia.kt @@ -71,11 +71,11 @@ abstract class MangaThemesia( return fetchMangaDetails( SManga.create() - .apply { this.url = "$mangaUrlDirectory/$mangaPath" } + .apply { this.url = "$mangaUrlDirectory/$mangaPath/" } ) .map { // Isn't set in returned manga - it.url = "$mangaUrlDirectory/$id" + it.url = "$mangaUrlDirectory/$mangaPath/" MangasPage(listOf(it), false) } } @@ -120,6 +120,7 @@ abstract class MangaThemesia( else -> { /* Do Nothing */ } } } + url.addPathSegment("") return GET(url.toString()) } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt index 459d72c49..05af21d45 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt @@ -11,7 +11,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator { override val themeClass = "MangaThemesia" - override val baseVersionCode: Int = 23 + override val baseVersionCode: Int = 24 override val sources = listOf( MultiLang("Asura Scans", "https://www.asurascans.com", listOf("en", "tr"), className = "AsuraScansFactory", pkgName = "asurascans", overrideVersionCode = 18),