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' appName = 'Tachiyomi: Dynasty'
pkgNameSuffix = "en.dynasty" pkgNameSuffix = "en.dynasty"
extClass = '.DynastyAnthologies; .DynastyIssues; .DynastySeries; .DynastyDoujins' extClass = '.DynastyAnthologies; .DynastyIssues; .DynastySeries; .DynastyDoujins'
extVersionCode = 1 extVersionCode = 2
extVersionSuffix = 1 extVersionSuffix = 2
libVersion = '1.2' libVersion = '1.2'
} }

View File

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