MMRCMS - fix mangas.pw decoding (#3563)

This commit is contained in:
Mike 2020-06-19 00:27:49 -04:00 committed by GitHub
parent 8874e85b92
commit 3e308f3f52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 14 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: My Manga Reader CMS (Many sources)' appName = 'Tachiyomi: My Manga Reader CMS (Many sources)'
pkgNameSuffix = 'all.mmrcms' pkgNameSuffix = 'all.mmrcms'
extClass = '.MyMangaReaderCMSSources' extClass = '.MyMangaReaderCMSSources'
extVersionCode = 42 extVersionCode = 43
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -17,6 +17,7 @@ import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.source.online.HttpSource
import eu.kanade.tachiyomi.util.asJsoup import eu.kanade.tachiyomi.util.asJsoup
import java.net.URLDecoder
import java.text.ParseException import java.text.ParseException
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
@ -334,23 +335,15 @@ class MyMangaReaderCMSSource(
override fun pageListParse(response: Response) = response.asJsoup().select("#all > .img-responsive") override fun pageListParse(response: Response) = response.asJsoup().select("#all > .img-responsive")
.mapIndexed { i, e -> .mapIndexed { i, e ->
var url = e.attr("abs:data-src") var url = (if (e.hasAttr("data-src")) e.attr("abs:data-src") else e.attr("abs:src")).trim()
if (url.isBlank()) {
url = e.attr("abs:src")
}
url = url.trim()
// Mangas.pw encodes some of their urls, decode them // Mangas.pw encodes some of their urls, decode them
if (url.contains("mangas.pw") && url.contains("img.php")) { if (name.contains("Mangas.pw") && !url.contains(".")) {
url = url.substringAfter("i=") url = Base64.decode(url.substringAfter("//"), Base64.DEFAULT).toString(Charsets.UTF_8).substringBefore("=")
repeat(5) { url = URLDecoder.decode(url, "UTF-8")
url = Base64.decode(url, Base64.DEFAULT).toString(Charsets.UTF_8).substringBefore("=")
}
} }
Page(i, url, url) Page(i, "", url)
} }
override fun imageUrlParse(response: Response) = throw UnsupportedOperationException("Unused method called!") override fun imageUrlParse(response: Response) = throw UnsupportedOperationException("Unused method called!")