Update Newtoki Extension v1.2.17 (#4423)

Update Newtoki Extension v1.2.17
This commit is contained in:
DitFranXX 2020-09-22 03:08:15 +09:00 committed by GitHub
parent 8143b34bf0
commit df84417403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'NewToki / ManaToki(ManaMoa)'
pkgNameSuffix = 'ko.newtoki'
extClass = '.NewTokiFactory'
extVersionCode = 16
extVersionCode = 17
libVersion = '1.2'
}

View File

@ -209,7 +209,9 @@ open class NewToki(override val name: String, private val defaultBaseUrl: String
private val htmlDataRegex = Regex("""html_data\+='([^']+)'""")
override fun pageListParse(document: Document): List<Page> {
val script = document.select("script:containsData(html_data)").firstOrNull()?.data() ?: throw Exception("script not found")
val script = document.select("script:containsData(html_data)").firstOrNull()?.data() ?: throw Exception("data script not found")
val loadScript = document.select("script:containsData(data_attribute)").firstOrNull()?.data() ?: throw Exception("load script not found")
val dataAttr = "abs:data-" + loadScript.substringAfter("data_attribute: '").substringBefore("',")
return htmlDataRegex.findAll(script).map { it.groupValues[1] }
.asIterable()
@ -217,7 +219,7 @@ open class NewToki(override val name: String, private val defaultBaseUrl: String
.joinToString("") { it.toIntOrNull(16)?.toChar()?.toString() ?: "" }
.let { Jsoup.parse(it) }
.select("img[alt]")
.mapIndexed { i, img -> Page(i, "", if (img.hasAttr("abs:data-original")) img.attr("abs:data-original") else img.attr("abs:content")) }
.mapIndexed { i, img -> Page(i, "", if (img.hasAttr(dataAttr)) img.attr(dataAttr) else img.attr("abs:content")) }
}
override fun latestUpdatesSelector() = popularMangaSelector()