leviatanscans replace random url part (#9717)
This commit is contained in:
parent
f546b99eff
commit
8e34cc2a8e
|
@ -3,6 +3,9 @@ package eu.kanade.tachiyomi.extension.all.leviatanscans
|
|||
import eu.kanade.tachiyomi.multisrc.madara.Madara
|
||||
import eu.kanade.tachiyomi.source.Source
|
||||
import eu.kanade.tachiyomi.source.SourceFactory
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import org.jsoup.nodes.Element
|
||||
|
||||
class LeviatanScansFactory : SourceFactory {
|
||||
override fun createSources(): List<Source> = listOf(
|
||||
|
@ -12,7 +15,43 @@ class LeviatanScansFactory : SourceFactory {
|
|||
}
|
||||
class LeviatanScansEN : Madara("Leviatan Scans", "https://leviatanscans.com", "en") {
|
||||
override val useNewChapterEndpoint: Boolean = true
|
||||
|
||||
override fun popularMangaFromElement(element: Element) =
|
||||
replaceRandomUrlPartInManga(super.popularMangaFromElement(element))
|
||||
|
||||
override fun latestUpdatesFromElement(element: Element) =
|
||||
replaceRandomUrlPartInManga(super.latestUpdatesFromElement(element))
|
||||
|
||||
override fun searchMangaFromElement(element: Element) =
|
||||
replaceRandomUrlPartInManga(super.searchMangaFromElement(element))
|
||||
|
||||
override fun chapterFromElement(element: Element) =
|
||||
replaceRandomUrlPartInChapter(super.chapterFromElement(element))
|
||||
}
|
||||
class LeviatanScansES : Madara("Leviatan Scans", "https://es.leviatanscans.com", "es") {
|
||||
override val useNewChapterEndpoint: Boolean = true
|
||||
|
||||
override fun popularMangaFromElement(element: Element) =
|
||||
replaceRandomUrlPartInManga(super.popularMangaFromElement(element))
|
||||
|
||||
override fun latestUpdatesFromElement(element: Element) =
|
||||
replaceRandomUrlPartInManga(super.latestUpdatesFromElement(element))
|
||||
|
||||
override fun searchMangaFromElement(element: Element) =
|
||||
replaceRandomUrlPartInManga(super.searchMangaFromElement(element))
|
||||
|
||||
override fun chapterFromElement(element: Element) =
|
||||
replaceRandomUrlPartInChapter(super.chapterFromElement(element))
|
||||
}
|
||||
|
||||
fun Madara.replaceRandomUrlPartInManga(manga: SManga): SManga {
|
||||
val split = manga.url.split("/")
|
||||
manga.url = split.slice(split.indexOf("manga") until split.size).joinToString("/", "/")
|
||||
return manga
|
||||
}
|
||||
|
||||
fun Madara.replaceRandomUrlPartInChapter(chapter: SChapter): SChapter {
|
||||
val split = chapter.url.split("/")
|
||||
chapter.url = baseUrl + split.slice(split.indexOf("manga") until split.size).joinToString("/", "/")
|
||||
return chapter
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ class MadaraGenerator : ThemeSourceGenerator {
|
|||
override val baseVersionCode: Int = 11
|
||||
|
||||
override val sources = listOf(
|
||||
MultiLang("Leviatan Scans", "https://leviatanscans.com", listOf("en", "es"), className = "LeviatanScansFactory", overrideVersionCode = 7),
|
||||
MultiLang("Leviatan Scans", "https://leviatanscans.com", listOf("en", "es"), className = "LeviatanScansFactory", overrideVersionCode = 8),
|
||||
MultiLang("MangaForFree.net", "https://mangaforfree.net", listOf("en", "ko", "all"), isNsfw = true, className = "MangaForFreeFactory", pkgName = "mangaforfree", overrideVersionCode = 1),
|
||||
MultiLang("Manhwa18.cc", "https://manhwa18.cc", listOf("en", "ko", "all"), isNsfw = true, className = "Manhwa18CcFactory", pkgName = "manhwa18cc"),
|
||||
MultiLang("Reaper Scans", "https://reaperscans.com", listOf("en", "pt-BR"), className = "ReaperScansFactory", pkgName = "reaperscans", overrideVersionCode = 2),
|
||||
|
|
Loading…
Reference in New Issue