Add more languages to RS. (#11589)

This commit is contained in:
Alessandro Jean 2022-04-23 21:01:48 -03:00 committed by GitHub
parent 01ec577e0e
commit 4cbfa756a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 61 additions and 101 deletions

View File

@ -4,6 +4,7 @@ import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.source.SourceFactory
import eu.kanade.tachiyomi.source.model.SChapter
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.OkHttpClient
import org.jsoup.nodes.Element
import java.text.SimpleDateFormat
@ -13,7 +14,10 @@ import java.util.concurrent.TimeUnit
class ReaperScansFactory : SourceFactory {
override fun createSources() = listOf(
ReaperScansEn(),
ReaperScansBr()
ReaperScansBr(),
ReaperScansTr(),
ReaperScansId(),
ReaperScansFr()
)
}
@ -21,44 +25,69 @@ abstract class ReaperScans(
override val baseUrl: String,
lang: String,
dateFormat: SimpleDateFormat = SimpleDateFormat("MMMM dd, yyyy", Locale.US)
) : Madara("Reaper Scans", baseUrl, lang, dateFormat)
) : Madara("Reaper Scans", baseUrl, lang, dateFormat) {
class ReaperScansEn : ReaperScans("https://reaperscans.com", "en", SimpleDateFormat("MMM dd,yyyy", Locale.US)) {
override val versionId = 2
override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply {
val urlElement = element.selectFirst(chapterUrlSelector)!!
override fun chapterFromElement(element: Element): SChapter {
val chapter = SChapter.create()
with(element) {
select(chapterUrlSelector).first()?.let { urlElement ->
chapter.url = urlElement.attr("abs:href").let {
it.substringBefore("?style=paged") + if (!it.endsWith(chapterUrlSuffix)) chapterUrlSuffix else ""
}
chapter.name = urlElement.select("p.chapter-manhwa-title").firstOrNull()?.text().toString()
}
chapter.date_upload = select("span.chapter-release-date > i").firstOrNull()?.text().let { parseChapterDate(it) }
}
return chapter
name = urlElement.selectFirst("p.chapter-manhwa-title")?.text()
?: urlElement.ownText()
date_upload = urlElement.selectFirst("span.chapter-release-date > i")?.text()
.let { parseChapterDate(it) }
val fixedUrl = urlElement.attr("abs:href").toHttpUrl().newBuilder()
.removeAllQueryParameters("style")
.addQueryParameter("style", "list")
.toString()
setUrlWithoutDomain(fixedUrl)
}
}
class ReaperScansBr : ReaperScans("https://reaperscans.com.br", "pt-BR", SimpleDateFormat("dd/MM/yyyy", Locale.US)) {
class ReaperScansEn : ReaperScans(
"https://reaperscans.com",
"en",
SimpleDateFormat("MMM dd,yyyy", Locale.US)
) {
override val versionId = 2
}
class ReaperScansBr : ReaperScans(
"https://reaperscans.com.br",
"pt-BR",
SimpleDateFormat("dd/MM/yyyy", Locale.US)
) {
override val id = 7767018058145795388
override val client: OkHttpClient = super.client.newBuilder()
.addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS))
.build()
override fun chapterFromElement(element: Element): SChapter {
val chapter = SChapter.create()
with(element) {
select(chapterUrlSelector).first()?.let { urlElement ->
chapter.url = urlElement.attr("abs:href").let {
it.substringBefore("?style=paged") + if (!it.endsWith(chapterUrlSuffix)) chapterUrlSuffix else ""
}
chapter.name = urlElement.ownText()
}
chapter.date_upload = select("span.chapter-release-date > i").firstOrNull()?.text().let { parseChapterDate(it) }
}
return chapter
}
}
class ReaperScansTr : ReaperScans(
"https://reaperscanstr.com",
"tr",
SimpleDateFormat("MMMMM dd, yyyy", Locale("tr"))
) {
// Tags are useless as they are just SEO keywords.
override val mangaDetailsSelectorTag = ""
}
class ReaperScansId : ReaperScans("https://reaperscans.id", "id") {
// Tags are useless as they are just SEO keywords.
override val mangaDetailsSelectorTag = ""
}
class ReaperScansFr : ReaperScans(
"https://new.reaperscans.fr",
"fr",
SimpleDateFormat("dd/MM/yyyy", Locale.US)
) {
// Migrated from WpMangaReader to Madara.
override val versionId = 2
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

View File

@ -1,68 +0,0 @@
package eu.kanade.tachiyomi.extension.fr.gsnation
import eu.kanade.tachiyomi.multisrc.wpmangareader.WPMangaReader
import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.model.SManga
import okhttp3.Response
import org.jsoup.nodes.Document
import java.text.SimpleDateFormat
import java.util.Locale
class ReaperScansFR : WPMangaReader("ReaperScans.fr (GS)", "https://reaperscans.fr", "fr", dateFormat = SimpleDateFormat("MMMM dd, yyyy", Locale.FRANCE)) {
// Formerly "GS Nation"
override val id: Long = 8953394032396297337
// remove the novels from the response
override fun searchMangaParse(response: Response): MangasPage {
val mangasPage = super.searchMangaParse(response)
return MangasPage(
mangasPage.mangas
.filterNot { it.title.startsWith("novel", true) }
.distinctBy { it.url },
mangasPage.hasNextPage
)
}
override fun latestUpdatesParse(response: Response): MangasPage = searchMangaParse(response)
override fun popularMangaParse(response: Response): MangasPage = searchMangaParse(response)
override fun mangaDetailsParse(document: Document) = SManga.create().apply {
author = document.select(".imptdt:contains(auteur) i").text()
artist = document.select(".tsinfo .imptdt:contains(artiste) i").text()
genre = document.select(".mgen a").joinToString { it.text() }
status = parseStatus(document.select(".tsinfo .imptdt:contains(statut) i").text())
thumbnail_url = document.select("div.thumb img").attr("abs:src")
description = document.select(".entry-content[itemprop=description]").joinToString("\n") { it.text() }
title = document.selectFirst("h1.entry-title").text()
// add series type(manga/manhwa/manhua/other) thinggy to genre
document.select(seriesTypeSelector).firstOrNull()?.ownText()?.let {
if (it.isEmpty().not() && genre!!.contains(it, true).not()) {
genre += if (genre!!.isEmpty()) it else ", $it"
}
}
// add alternative name to manga description
document.select(altNameSelector).firstOrNull()?.ownText()?.let {
if (it.isBlank().not()) {
description = when {
description.isNullOrBlank() -> altName + it
else -> description + "\n\n$altName" + it
}
}
}
}
override fun parseStatus(status: String) = when {
status.contains("En cours") -> SManga.ONGOING
status.contains("Terminée") -> SManga.COMPLETED
status.contains("Licenciée") -> SManga.LICENSED
else -> SManga.UNKNOWN
}
}

View File

@ -16,7 +16,7 @@ class MadaraGenerator : ThemeSourceGenerator {
MultiLang("Leviatan Scans", "https://leviatanscans.com", listOf("en", "es"), className = "LeviatanScansFactory", overrideVersionCode = 9),
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", overrideVersionCode = 1),
MultiLang("Reaper Scans", "https://reaperscans.com", listOf("en", "pt-BR"), className = "ReaperScansFactory", pkgName = "reaperscans", overrideVersionCode = 4),
MultiLang("Reaper Scans", "https://reaperscans.com", listOf("en", "pt-BR", "fr", "id", "tr"), className = "ReaperScansFactory", pkgName = "reaperscans", overrideVersionCode = 5),
MultiLang("Seven King Scanlation", "https://sksubs.net", listOf("es", "en"), isNsfw = true),
MultiLang("YugenMangas", "https://yugenmangas.com", listOf("es", "pt-BR"), overrideVersionCode = 2),
SingleLang("1st Kiss Manga.love", "https://1stkissmanga.love", "en", className = "FirstKissMangaLove", overrideVersionCode = 1),

View File

@ -40,7 +40,6 @@ class WPMangaReaderGenerator : ThemeSourceGenerator {
SingleLang("Shimada Scans", "https://shimadascans.com", "en"),
SingleLang("Shooting Star Scans", "https://shootingstarscans.com", "en", overrideVersionCode = 3),
SingleLang("Azure Scans", "https://azuremanga.com", "en", overrideVersionCode = 1),
SingleLang("ReaperScans.fr (GS)", "https://reaperscans.fr", "fr", className = "ReaperScansFR", pkgName = "gsnation", overrideVersionCode = 2),
SingleLang("Patatescans", "https://patatescans.com", "fr", isNsfw = true, overrideVersionCode = 2),
SingleLang("Fusion Scanlation", "https://fusionscanlation.com", "es", className = "FusionScanlation", overrideVersionCode = 2),
SingleLang("Ace Scans", "https://acescans.xyz", "en", isNsfw = true, overrideVersionCode = 1),