From 66017dc4320ee6a58e0e3c9dea0a69d54451779c Mon Sep 17 00:00:00 2001 From: Mike <51273546+SnakeDoc83@users.noreply.github.com> Date: Wed, 17 Jul 2019 22:36:20 -0400 Subject: [PATCH] MMRCMS (Mangas.pw decoding) (#1304) --- src/all/mmrcms/build.gradle | 2 +- .../extension/all/mmrcms/MyMangaReaderCMSSource.kt | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/all/mmrcms/build.gradle b/src/all/mmrcms/build.gradle index a9b0619e3..76d04afb0 100644 --- a/src/all/mmrcms/build.gradle +++ b/src/all/mmrcms/build.gradle @@ -5,7 +5,7 @@ ext { appName = 'Tachiyomi: My Manga Reader CMS (Many sources)' pkgNameSuffix = 'all.mmrcms' extClass = '.MyMangaReaderCMSSources' - extVersionCode = 20 + extVersionCode = 21 libVersion = '1.2' } diff --git a/src/all/mmrcms/src/eu/kanade/tachiyomi/extension/all/mmrcms/MyMangaReaderCMSSource.kt b/src/all/mmrcms/src/eu/kanade/tachiyomi/extension/all/mmrcms/MyMangaReaderCMSSource.kt index 8ba6315e2..c9edd24f4 100644 --- a/src/all/mmrcms/src/eu/kanade/tachiyomi/extension/all/mmrcms/MyMangaReaderCMSSource.kt +++ b/src/all/mmrcms/src/eu/kanade/tachiyomi/extension/all/mmrcms/MyMangaReaderCMSSource.kt @@ -16,6 +16,7 @@ import org.jsoup.nodes.Element import java.text.ParseException import java.text.SimpleDateFormat import java.util.* +import android.util.Base64 class MyMangaReaderCMSSource(override val lang: String, override val name: String, @@ -79,7 +80,7 @@ class MyMangaReaderCMSSource(override val lang: String, if (urlElement.size == 0) { url = getUrlWithoutBaseUrl(it.select("a").attr("href")) title = it.select("div.caption").text() - (it.select("div.caption div").text()).let { if (it.isNotEmpty()) title = title.substringBefore(it)} // For submanga and to not break hentaishark + it.select("div.caption div").text().let { if (it.isNotEmpty()) title = title.substringBefore(it)} // To clean submanga's titles without breaking hentaishark's } else { url = getUrlWithoutBaseUrl(urlElement.attr("href")) title = urlElement.text().trim() @@ -268,6 +269,14 @@ class MyMangaReaderCMSSource(override val lang: String, url = url.trim() + // Mangas.pw encodes some of their urls, decode them + if (url.contains("mangas.pw") && url.contains("img.php")) { + url = url.substringAfter("i=") + repeat (5) { + url = Base64.decode(url, Base64.DEFAULT).toString(Charsets.UTF_8).substringBefore("=") + } + } + Page(i, url, url) }