Weeb Central: fix broken chapter link (#6129)

This commit is contained in:
Vetle Ledaal 2024-11-18 19:14:08 +01:00 committed by GitHub
parent 9eca1d4125
commit c29330892a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Weeb Central' extName = 'Weeb Central'
extClass = '.WeebCentral' extClass = '.WeebCentral'
extVersionCode = 2 extVersionCode = 3
isNsfw = true isNsfw = true
} }

View File

@ -8,6 +8,7 @@ import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.ParsedHttpSource import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.Request import okhttp3.Request
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
@ -150,6 +151,21 @@ class WeebCentral : ParsedHttpSource() {
} }
// =============================== Pages ================================ // =============================== Pages ================================
override fun pageListRequest(chapter: SChapter): Request {
val newUrl = (baseUrl + chapter.url)
.toHttpUrlOrNull()
?.newBuilder()
?.addPathSegment("images")
?.addQueryParameter("is_prev", "False")
?.addQueryParameter("reading_style", "long_strip")
?.build()
?.toString()
?: chapter.url
chapter.setUrlWithoutDomain(newUrl)
return super.pageListRequest(chapter)
}
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
return document.select("section[x-data~=scroll] > img").mapIndexed { index, element -> return document.select("section[x-data~=scroll] > img").mapIndexed { index, element ->
Page(index, imageUrl = element.attr("abs:src")) Page(index, imageUrl = element.attr("abs:src"))