From 3e308f3f52e6a101f158eab0b49077ed630c68ed Mon Sep 17 00:00:00 2001 From: Mike <51273546+SnakeDoc83@users.noreply.github.com> Date: Fri, 19 Jun 2020 00:27:49 -0400 Subject: [PATCH] MMRCMS - fix mangas.pw decoding (#3563) --- src/all/mmrcms/build.gradle | 2 +- .../all/mmrcms/MyMangaReaderCMSSource.kt | 19 ++++++------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/all/mmrcms/build.gradle b/src/all/mmrcms/build.gradle index 260cdbf29..dc83e923c 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 = 42 + extVersionCode = 43 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 ed9994816..cd0e3ea65 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 @@ -17,6 +17,7 @@ import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.util.asJsoup +import java.net.URLDecoder import java.text.ParseException import java.text.SimpleDateFormat import java.util.Locale @@ -334,23 +335,15 @@ class MyMangaReaderCMSSource( override fun pageListParse(response: Response) = response.asJsoup().select("#all > .img-responsive") .mapIndexed { i, e -> - var url = e.attr("abs:data-src") - - if (url.isBlank()) { - url = e.attr("abs:src") - } - - url = url.trim() + var url = (if (e.hasAttr("data-src")) e.attr("abs:data-src") else e.attr("abs:src")).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("=") - } + if (name.contains("Mangas.pw") && !url.contains(".")) { + url = Base64.decode(url.substringAfter("//"), Base64.DEFAULT).toString(Charsets.UTF_8).substringBefore("=") + url = URLDecoder.decode(url, "UTF-8") } - Page(i, url, url) + Page(i, "", url) } override fun imageUrlParse(response: Response) = throw UnsupportedOperationException("Unused method called!")