Fix Japscan (#2128)

Fix Japscan
This commit is contained in:
happywillow0 2020-01-26 00:22:42 -05:00 committed by arkon
parent 3fb1225f45
commit 96116dac10
2 changed files with 5 additions and 4 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: Japscan' appName = 'Tachiyomi: Japscan'
pkgNameSuffix = 'fr.japscan' pkgNameSuffix = 'fr.japscan'
extClass = '.Japscan' extClass = '.Japscan'
extVersionCode = 13 extVersionCode = 14
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -88,7 +88,7 @@ class Japscan : ParsedHttpSource() {
.replace("[\\W]".toRegex(), "-") .replace("[\\W]".toRegex(), "-")
.replace("[-]{2,}".toRegex(), "-") .replace("[-]{2,}".toRegex(), "-")
.replace("^-|-$".toRegex(), "") .replace("^-|-$".toRegex(), "")
manga.thumbnail_url = "$baseUrl/imgs/mangas/$s.jpg" manga.thumbnail_url = "$baseUrl/imgs/mangas/$s.jpg".toLowerCase()
} }
return manga return manga
} }
@ -205,11 +205,12 @@ class Japscan : ParsedHttpSource() {
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
val pages = mutableListOf<Page>() val pages = mutableListOf<Page>()
val imagePath = "(.*\\/).*".toRegex().find(document.select("#image").attr("data-src")) var imagePath = "(.*\\/).*".toRegex().find(document.select("#image").attr("data-src"))?.groupValues?.get(1)
val imageScrambled = if (!document.select("script[src^='/js/iYFbYi_U']").isNullOrEmpty()) "&decodeImage" else "" val imageScrambled = if (!document.select("script[src^='/js/iYFbYi_U']").isNullOrEmpty()) "&decodeImage" else ""
document.select("select#pages").first()?.select("option")?.forEach { document.select("select#pages").first()?.select("option")?.forEach {
pages.add(Page(pages.size, "", "${imagePath?.groupValues?.get(1)}${it.attr("data-img")}$imageScrambled")) if (it.attr("data-img").startsWith("http")) imagePath = ""
pages.add(Page(pages.size, "", "$imagePath${it.attr("data-img")}$imageScrambled"))
} }
return pages return pages