diff --git a/src/en/oglaf/build.gradle b/src/en/oglaf/build.gradle index d6f616aeb..2e651462e 100644 --- a/src/en/oglaf/build.gradle +++ b/src/en/oglaf/build.gradle @@ -5,7 +5,7 @@ ext { appName = 'Tachiyomi: Oglaf' pkgNameSuffix = 'en.oglaf' extClass = '.Oglaf' - extVersionCode = 2 + extVersionCode = 3 libVersion = '1.2' } diff --git a/src/en/oglaf/src/eu/kanade/tachiyomi/extension/en/oglaf/Oglaf.kt b/src/en/oglaf/src/eu/kanade/tachiyomi/extension/en/oglaf/Oglaf.kt index a48ef2201..f545f0cfa 100644 --- a/src/en/oglaf/src/eu/kanade/tachiyomi/extension/en/oglaf/Oglaf.kt +++ b/src/en/oglaf/src/eu/kanade/tachiyomi/extension/en/oglaf/Oglaf.kt @@ -1,14 +1,15 @@ package eu.kanade.tachiyomi.extension.en.oglaf +import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.online.ParsedHttpSource +import eu.kanade.tachiyomi.util.asJsoup import okhttp3.Request import okhttp3.Response -import org.jsoup.Jsoup import org.jsoup.nodes.Document import org.jsoup.nodes.Element import rx.Observable @@ -60,14 +61,16 @@ class Oglaf : ParsedHttpSource() { override fun pageListParse(document: Document): List { val urlRegex = """/.*/\d*/""".toRegex() - val imageUrl = document.select("img#strip").attr("src") val pages = mutableListOf() - pages.add(Page(0, "", imageUrl)) - val next = document.select("a[rel=next]").attr("href") - if (urlRegex.matches(next)) { - val nextPage = Jsoup.connect(baseUrl + next).get() - pages.addAll(pageListParse(nextPage)) + + fun addPage(document: Document) { + pages.add(Page(pages.size, "", document.select("img#strip").attr("abs:src"))) + val next = document.select("a[rel=next]").attr("href") + if (urlRegex.matches(next)) addPage(client.newCall(GET(baseUrl + next, headers)).execute().asJsoup()) } + + addPage(document) + return pages }