LuraToon: bypass chapter link redirect (#3359)

LuraToon: fix chapter links redirect
This commit is contained in:
AwkwardPeak7 2024-06-03 15:50:08 +05:00 committed by GitHub
parent c47b9d852d
commit 029a53ff90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View File

@ -3,7 +3,7 @@ ext {
extClass = '.LuraToon'
themePkg = 'peachscan'
baseUrl = 'https://luratoons.com'
overrideVersionCode = 43
overrideVersionCode = 44
}
apply from: "$rootDir/common.gradle"

View File

@ -10,6 +10,8 @@ import eu.kanade.tachiyomi.lib.randomua.setRandomUserAgent
import eu.kanade.tachiyomi.multisrc.peachscan.PeachScan
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.ConfigurableSource
import eu.kanade.tachiyomi.source.model.SChapter
import org.jsoup.nodes.Element
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -36,4 +38,16 @@ class LuraToon :
override fun setupPreferenceScreen(screen: PreferenceScreen) {
addRandomUAPreferenceToScreen(screen)
}
override fun chapterFromElement(element: Element): SChapter {
val mangaUrl = element.ownerDocument()!!.location()
return super.chapterFromElement(element).apply {
val num = url.removeSuffix("/")
.substringAfterLast("/")
val chapUrl = mangaUrl.removeSuffix("/") + "/$num/"
setUrlWithoutDomain(chapUrl)
}
}
}