PlotTwistNoFansub: Fix page loading (#3186)
* Fix page loading * Cleanup
This commit is contained in:
parent
ad0b1a041d
commit
34ee8297d2
|
@ -1,7 +1,7 @@
|
||||||
ext {
|
ext {
|
||||||
extName = 'Plot Twist No Fansub'
|
extName = 'Plot Twist No Fansub'
|
||||||
extClass = '.PlotTwistNoFansub'
|
extClass = '.PlotTwistNoFansub'
|
||||||
extVersionCode = 5
|
extVersionCode = 6
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,9 +188,10 @@ class PlotTwistNoFansub : ParsedHttpSource(), ConfigurableSource {
|
||||||
override fun chapterFromElement(element: Element): SChapter = throw UnsupportedOperationException()
|
override fun chapterFromElement(element: Element): SChapter = throw UnsupportedOperationException()
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
val script = document.selectFirst("script#clarity-reader-nav-js-extra")!!.data()
|
val script = document.select("script")
|
||||||
val pagesJson = CHAPTER_PAGES_REGEX.find(script)!!.groupValues[1]
|
.map(Element::data)
|
||||||
val result = json.decodeFromString<PagesPayloadDto>(pagesJson)
|
.firstNotNullOf(CHAPTER_PAGES_REGEX::find)
|
||||||
|
val result = json.decodeFromString<PagesPayloadDto>(script.groups["json"]!!.value)
|
||||||
val mangaSlug = "${result.cdnUrl}/${result.mangaSlug}"
|
val mangaSlug = "${result.cdnUrl}/${result.mangaSlug}"
|
||||||
val chapterNumber = result.chapterNumber
|
val chapterNumber = result.chapterNumber
|
||||||
return result.images.mapIndexed { i, img ->
|
return result.images.mapIndexed { i, img ->
|
||||||
|
@ -259,7 +260,7 @@ class PlotTwistNoFansub : ParsedHttpSource(), ConfigurableSource {
|
||||||
companion object {
|
companion object {
|
||||||
private val MANGAID1_REGEX = ""","manid":"(\d+)",""".toRegex()
|
private val MANGAID1_REGEX = ""","manid":"(\d+)",""".toRegex()
|
||||||
private val UNESCAPE_REGEX = """\\(.)""".toRegex()
|
private val UNESCAPE_REGEX = """\\(.)""".toRegex()
|
||||||
private val CHAPTER_PAGES_REGEX = """obj\s*=\s*(.*)\s*;""".toRegex()
|
private val CHAPTER_PAGES_REGEX = """obj\s*=\s*(?<json>.*)\s*;""".toRegex()
|
||||||
private val ACTION_REGEX = """action:\s*?(['"])([^\r\n]+?)\1""".toRegex()
|
private val ACTION_REGEX = """action:\s*?(['"])([^\r\n]+?)\1""".toRegex()
|
||||||
private const val MAX_MANGA_RESULTS = 1000
|
private const val MAX_MANGA_RESULTS = 1000
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue