Mangasee - change pageListParse (#3141)

This commit is contained in:
Mike 2020-05-13 07:32:31 -04:00 committed by GitHub
parent ff800f6fea
commit b659df6fd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 23 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: Mangasee' appName = 'Tachiyomi: Mangasee'
pkgNameSuffix = 'en.mangasee' pkgNameSuffix = 'en.mangasee'
extClass = '.Mangasee' extClass = '.Mangasee'
extVersionCode = 6 extVersionCode = 7
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -13,6 +13,7 @@ import java.util.regex.Pattern
import okhttp3.FormBody import okhttp3.FormBody
import okhttp3.HttpUrl import okhttp3.HttpUrl
import okhttp3.Request import okhttp3.Request
import org.json.JSONObject
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
@ -30,8 +31,6 @@ class Mangasee : ParsedHttpSource() {
private val recentUpdatesPattern = Pattern.compile("(.*?)\\s(\\d+\\.?\\d*)\\s?(Completed)?") private val recentUpdatesPattern = Pattern.compile("(.*?)\\s(\\d+\\.?\\d*)\\s?(Completed)?")
private val indexPattern = Pattern.compile("-index-(.*?)-")
override fun popularMangaSelector() = "div.requested > div.row" override fun popularMangaSelector() = "div.requested > div.row"
override fun popularMangaRequest(page: Int): Request { override fun popularMangaRequest(page: Int): Request {
@ -140,29 +139,18 @@ class Mangasee : ParsedHttpSource() {
} }
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
val fullUrl = document.baseUri() val pageArr = document.select("script:containsData(PageArr={)").first().data()
val url = fullUrl.substringBeforeLast('/') .substringAfter("PageArr=").substringBefore(";")
return JSONObject(pageArr).let { jsonObject ->
val pages = mutableListOf<Page>() jsonObject.keys()
.asSequence()
val series = document.select("input.IndexName").first().attr("value") .toList()
val chapter = document.select("span.CurChapter").first().text() .filter { it.toIntOrNull() is Int }
var index = "" .mapIndexed { i, key -> Page(i, "", jsonObject.getString(key)) }
val m = indexPattern.matcher(fullUrl)
if (m.find()) {
val indexNumber = m.group(1)
index = "-index-$indexNumber"
} }
document.select("div.ContainerNav").first().select("select.PageSelect > option").forEach { _ ->
pages.add(Page(pages.size, "$url/$series-chapter-$chapter$index-page-${pages.size + 1}.html"))
}
pages.getOrNull(0)?.imageUrl = imageUrlParse(document)
return pages
} }
override fun imageUrlParse(document: Document): String = document.select("img.CurImage").attr("src") override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
override fun latestUpdatesNextPageSelector() = "button.requestMore" override fun latestUpdatesNextPageSelector() = "button.requestMore"