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)'
pkgNameSuffix = 'all.mmrcms'
extClass = '.MyMangaReaderCMSSources'
extVersionCode = 42
extVersionCode = 43
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.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!")