fixed pagelist empty error (#164)

This commit is contained in:
Carlos 2018-01-21 05:52:59 -05:00 committed by inorichi
parent b8426a32eb
commit 46bd262785
2 changed files with 4 additions and 9 deletions

View File

@ -5,8 +5,8 @@ ext {
appName = 'Tachiyomi: Dynasty'
pkgNameSuffix = "en.dynasty"
extClass = '.DynastyAnthologies; .DynastyIssues; .DynastySeries; .DynastyDoujins'
extVersionCode = 1
extVersionSuffix = 1
extVersionCode = 2
extVersionSuffix = 2
libVersion = '1.2'
}

View File

@ -17,7 +17,6 @@ import org.jsoup.nodes.Node
import org.jsoup.nodes.TextNode
import java.text.SimpleDateFormat
import java.util.*
import java.util.regex.Pattern
abstract class DynastyScans : ParsedHttpSource() {
@ -155,12 +154,8 @@ abstract class DynastyScans : ParsedHttpSource() {
override fun pageListParse(document: Document): List<Page> {
val pages = mutableListOf<Page>()
try {
val script = document.select("script").last()
val p = Pattern.compile("(?s)(pages)\\s??=\\s??\\[(.*?)\\]")
val m = p.matcher(script.html())
var imageUrls = JSONArray()
while (m.find())
imageUrls = JSONArray("[" + m.group(2) + "]")
val imageUrl = document.select("script").last().html().substringAfter("var pages = [").substringBefore("];")
var imageUrls = JSONArray("[$imageUrl]")
(0..imageUrls.length() - 1)
.map { imageUrls.getJSONObject(it) }