Fix Mangago reader (#104)

This commit is contained in:
Andy Bao 2017-09-23 07:35:24 -04:00 committed by inorichi
parent be29582e71
commit ba53784fe5
1 changed files with 10 additions and 4 deletions

View File

@ -136,12 +136,18 @@ class Mangago : ParsedHttpSource() {
date_upload = dateFormat.parse(element.getElementsByClass("no").text().trim()).time date_upload = dateFormat.parse(element.getElementsByClass("no").text().trim()).time
} }
override fun pageListParse(document: Document) private val JS_BEGIN_MARKER = "var imgsrcs = new Array('"
= document.getElementById("pagenavigation").getElementsByTag("a").mapIndexed { index, element -> override fun pageListParse(document: Document): List<Page> {
Page(index, element.attr("href")) val dString = document.toString()
val jsBegin = dString.indexOf(JS_BEGIN_MARKER) + JS_BEGIN_MARKER.length
val jsEnd = dString.indexOf("');", startIndex = jsBegin)
val arrString = dString.substring(jsBegin .. jsEnd)
return arrString.split("','").mapIndexed { i, s ->
Page(i, s, s)
}
} }
override fun imageUrlParse(document: Document) = document.getElementById("page1").attr("src")!! override fun imageUrlParse(document: Document) = throw UnsupportedOperationException("Unused method called!")
override fun getFilterList() = FilterList( override fun getFilterList() = FilterList(
//Mangago does not support genre filtering and text search at the same time //Mangago does not support genre filtering and text search at the same time