Update BarManga (#11375)
This commit is contained in:
parent
d8bef0a1af
commit
678b988f13
@ -3,7 +3,7 @@ ext {
|
||||
extClass = '.BarManga'
|
||||
themePkg = 'madara'
|
||||
baseUrl = 'https://libribar.com'
|
||||
overrideVersionCode = 4
|
||||
overrideVersionCode = 5
|
||||
isNsfw = false
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package eu.kanade.tachiyomi.extension.es.barmanga
|
||||
|
||||
import android.util.Base64
|
||||
import eu.kanade.tachiyomi.multisrc.madara.Madara
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import org.jsoup.nodes.Document
|
||||
@ -16,16 +17,31 @@ class BarManga : Madara(
|
||||
|
||||
override val mangaDetailsSelectorDescription = "div.flamesummary > div.manga-excerpt"
|
||||
|
||||
private val imageUrlRegex = """fetch\(['"](.*?)['"]\)""".toRegex()
|
||||
private val newImageUrlRegex = """var u1 = '([A-Za-z0-9+/=]+)';\s*var u2 = '([A-Za-z0-9+/=]+)';""".toRegex()
|
||||
override val pageListParseSelector = "div.page-break"
|
||||
|
||||
override fun pageListParse(document: Document): List<Page> {
|
||||
launchIO { countViews(document) }
|
||||
|
||||
return document.select(pageListParseSelector).mapIndexed { index, element ->
|
||||
val script = element.selectFirst("script")?.data()
|
||||
val imageUrl = script?.let { imageUrlRegex.find(it)?.groupValues?.get(1) }
|
||||
?: element.selectFirst("img")?.let { imageFromElement(it) }
|
||||
Page(index, document.location(), imageUrl)
|
||||
return document.select(pageListParseSelector).mapIndexedNotNull { index, element ->
|
||||
val scripts = element.select("script")
|
||||
|
||||
val scriptData = scripts.firstNotNullOfOrNull { script ->
|
||||
val data = script.data()
|
||||
if (data.contains("var u1") && data.contains("var u2")) {
|
||||
data
|
||||
} else {
|
||||
null
|
||||
}
|
||||
} ?: return@mapIndexedNotNull null
|
||||
|
||||
val match = newImageUrlRegex.find(scriptData) ?: return@mapIndexedNotNull null
|
||||
val (b64part1, b64part2) = match.destructured
|
||||
|
||||
val part1 = String(Base64.decode(b64part1, Base64.DEFAULT))
|
||||
val part2 = String(Base64.decode(b64part2, Base64.DEFAULT))
|
||||
|
||||
Page(index, document.location(), part1 + part2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user