diff --git a/src/en/hbrowse/build.gradle b/src/en/hbrowse/build.gradle index 9c6770a60..78ece40b5 100644 --- a/src/en/hbrowse/build.gradle +++ b/src/en/hbrowse/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'HBrowse' pkgNameSuffix = 'en.hbrowse' extClass = '.HBrowse' - extVersionCode = 4 + extVersionCode = 5 libVersion = '1.2' containsNsfw = true } diff --git a/src/en/hbrowse/src/eu/kanade/tachiyomi/extension/en/hbrowse/HBrowse.kt b/src/en/hbrowse/src/eu/kanade/tachiyomi/extension/en/hbrowse/HBrowse.kt index 029d1b1bb..e2accbaf4 100644 --- a/src/en/hbrowse/src/eu/kanade/tachiyomi/extension/en/hbrowse/HBrowse.kt +++ b/src/en/hbrowse/src/eu/kanade/tachiyomi/extension/en/hbrowse/HBrowse.kt @@ -9,12 +9,15 @@ 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 kotlinx.serialization.decodeFromString +import kotlinx.serialization.json.Json import okhttp3.CookieJar import okhttp3.FormBody import okhttp3.OkHttpClient import okhttp3.Request import org.jsoup.nodes.Document import org.jsoup.nodes.Element +import uy.kohesive.injekt.injectLazy import java.io.IOException @Nsfw @@ -28,6 +31,8 @@ class HBrowse : ParsedHttpSource() { override val supportsLatest = true + private val json: Json by injectLazy() + // Clients private lateinit var phpSessId: String @@ -171,14 +176,14 @@ class HBrowse : ParsedHttpSource() { // Pages override fun pageListParse(document: Document): List { - return document.select("td.pageList a").mapIndexed { i, element -> - Page(i, element.attr("abs:href")) - } + val script = document.select("script:containsData(imageDir)").first().data() + val imageDir = Regex("""imageDir\s*=\s*"(.+?)";""").find(script)?.groupValues!!.get(1) + var images = json.decodeFromString>(Regex("""list\s*=\s*(\[.+?]);""").find(script)?.groupValues!!.get(1)) + images = images.subList(0, images.size - 2) + return images.mapIndexed { index, element -> Page(index, "", baseUrl + imageDir + element) } } - override fun imageUrlParse(document: Document): String { - return document.select("img#mangaImage").attr("abs:src") - } + override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used") // Filters