Add a migrate to GH message in GS main extension (#11528)

* Add a migrate to GH message in GS main extension.

* Fix missing override in nullableChapterFromElement.
This commit is contained in:
Alessandro Jean 2022-04-19 18:55:28 -03:00 committed by GitHub
parent b1e252455f
commit 6339053df1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 15 deletions

View File

@ -10,24 +10,12 @@ import java.util.Locale
class FallenAngels : MMRCMS("Fallen Angels", "https://manga.fascans.com", "en") { class FallenAngels : MMRCMS("Fallen Angels", "https://manga.fascans.com", "en") {
/**
* Parses the response from the site and returns a list of chapters.
*
* Overriden to allow for null chapters
*
* @param response the response from the site.
*/
override fun chapterListParse(response: Response): List<SChapter> {
val document = response.asJsoup()
return document.select(chapterListSelector()).mapNotNull { nullableChapterFromElement(it) }
}
/** /**
* Returns a chapter from the given element. * Returns a chapter from the given element.
* *
* @param element an element obtained from [chapterListSelector]. * @param element an element obtained from [chapterListSelector].
*/ */
private fun nullableChapterFromElement(element: Element): SChapter? { override fun nullableChapterFromElement(element: Element): SChapter? {
val chapter = SChapter.create() val chapter = SChapter.create()
val titleWrapper = element.select("[class^=chapter-title-rtl]").first() val titleWrapper = element.select("[class^=chapter-title-rtl]").first()

View File

@ -4,8 +4,11 @@ import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
import eu.kanade.tachiyomi.multisrc.mmrcms.MMRCMS import eu.kanade.tachiyomi.multisrc.mmrcms.MMRCMS
import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.Request import okhttp3.Request
import okhttp3.Response
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
class GekkouScans : MMRCMS( class GekkouScans : MMRCMS(
@ -18,6 +21,22 @@ class GekkouScans : MMRCMS(
.addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS)) .addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS))
.build() .build()
override fun chapterListParse(response: Response): List<SChapter> {
val document = response.asJsoup()
val chapters = document.select(chapterListSelector())
.mapNotNull(::nullableChapterFromElement)
val isExternal = document
.select("ul.domaintld > li.li:has(a[href*='hentai.gekkouscans.com.br'])")
.firstOrNull() != null
if (chapters.isEmpty() && isExternal) {
throw Exception(EXTERNAL_SERIES_ERROR)
}
return chapters
}
override fun chapterListSelector() = "ul.domaintld > li.li:has(a[href^='$baseUrl'])" override fun chapterListSelector() = "ul.domaintld > li.li:has(a[href^='$baseUrl'])"
override fun imageRequest(page: Page): Request { override fun imageRequest(page: Page): Request {
@ -31,5 +50,8 @@ class GekkouScans : MMRCMS(
companion object { companion object {
private const val ACCEPT_IMAGE = "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8" private const val ACCEPT_IMAGE = "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8"
private const val EXTERNAL_SERIES_ERROR =
"Migre esta série para a extensão Gekkou Hentai para continuar lendo."
} }
} }

View File

@ -358,7 +358,7 @@ abstract class MMRCMS(
* *
* @param element an element obtained from [chapterListSelector]. * @param element an element obtained from [chapterListSelector].
*/ */
private fun nullableChapterFromElement(element: Element): SChapter? { protected open fun nullableChapterFromElement(element: Element): SChapter? {
val chapter = SChapter.create() val chapter = SChapter.create()
try { try {

View File

@ -63,7 +63,7 @@ class MMRCMSSources {
SourceData.Single("Op-VF", "https://www.op-vf.com", "fr", className = "OpVF"), SourceData.Single("Op-VF", "https://www.op-vf.com", "fr", className = "OpVF"),
SourceData.Single("FR Scan", "https://frscan.cc", "fr", overrideVersionCode = 1), SourceData.Single("FR Scan", "https://frscan.cc", "fr", overrideVersionCode = 1),
SourceData.Single("Ama Scans", "https://amascan.com", "pt-BR", isNsfw = true, overrideVersionCode = 2), SourceData.Single("Ama Scans", "https://amascan.com", "pt-BR", isNsfw = true, overrideVersionCode = 2),
SourceData.Single("Gekkou Scans", "https://gekkou.com.br", "pt-BR", isNsfw = true, pkgName = "gekkouscan", overrideVersionCode = 11), SourceData.Single("Gekkou Scans", "https://gekkou.com.br", "pt-BR", isNsfw = true, pkgName = "gekkouscan", overrideVersionCode = 12),
SourceData.Single("Gekkou Hentai", "https://hentai.gekkouscans.com.br", "pt-BR", isNsfw = true), SourceData.Single("Gekkou Hentai", "https://hentai.gekkouscans.com.br", "pt-BR", isNsfw = true),
SourceData.Single("White Cloud Pavilion", "https://whitecloudpavilion.com/manga/patreon", "en"), SourceData.Single("White Cloud Pavilion", "https://whitecloudpavilion.com/manga/patreon", "en"),
// NOTE: THIS SOURCE CONTAINS A CUSTOM LANGUAGE SYSTEM (which will be ignored)! // NOTE: THIS SOURCE CONTAINS A CUSTOM LANGUAGE SYSTEM (which will be ignored)!