Add two new sources to Madara (#18516)

Add two new sources to Madara.
This commit is contained in:
Alessandro Jean 2023-10-12 17:19:21 -03:00 committed by GitHub
parent 713bfccec5
commit aba668c1bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,63 @@
package eu.kanade.tachiyomi.extension.pt.ladyestelarscan
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.network.asObservable
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.MangasPage
import okhttp3.Call
import okhttp3.OkHttpClient
import okhttp3.Response
import rx.Observable
import java.lang.IllegalStateException
import java.text.SimpleDateFormat
import java.util.Locale
import java.util.concurrent.TimeUnit
class LadyEstelarScan : Madara(
"Lady Estelar Scan",
"https://ladyestelarscan.com.br",
"pt-BR",
SimpleDateFormat("dd/MM/yyyy", Locale("pt", "BR")),
) {
override val client: OkHttpClient = super.client.newBuilder()
.rateLimit(1, 2, TimeUnit.SECONDS)
.build()
override val useNewChapterEndpoint = true
override fun fetchPopularManga(page: Int): Observable<MangasPage> {
return client.newCall(popularMangaRequest(page))
.asObservableSuccessIgnoreCode(404)
.map(::popularMangaParse)
}
override fun fetchLatestUpdates(page: Int): Observable<MangasPage> {
return client.newCall(latestUpdatesRequest(page))
.asObservableSuccessIgnoreCode(404)
.map(::latestUpdatesParse)
}
override fun fetchSearchManga(
page: Int,
query: String,
filters: FilterList,
): Observable<MangasPage> {
return client.newCall(searchMangaRequest(page, query, filters))
.asObservableSuccessIgnoreCode(404)
.map(::searchMangaParse)
}
/**
* Their site have some issues and is returning 404 in some pages even if they exist.
*/
private fun Call.asObservableSuccessIgnoreCode(code: Int): Observable<Response> {
return asObservable().doOnNext { response ->
if (!response.isSuccessful && response.code != code) {
response.close()
throw IllegalStateException("HTTP error ${response.code}")
}
}
}
}

View File

@ -0,0 +1,22 @@
package eu.kanade.tachiyomi.extension.pt.passamaoscan
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import okhttp3.OkHttpClient
import java.text.SimpleDateFormat
import java.util.Locale
import java.util.concurrent.TimeUnit
class PassaMaoScan : Madara(
"Passa Mão Scan",
"https://passamaoscan.com",
"pt-BR",
SimpleDateFormat("dd/MM/yyyy", Locale("pt", "BR")),
) {
override val client: OkHttpClient = super.client.newBuilder()
.rateLimit(1, 2, TimeUnit.SECONDS)
.build()
override val useNewChapterEndpoint = true
}

View File

@ -183,6 +183,7 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("KomikRame", "https://komikra.me", "id"),
SingleLang("KSGroupScans", "https://ksgroupscans.com", "en"),
SingleLang("Kun Manga", "https://kunmanga.com", "en", overrideVersionCode = 1),
SingleLang("Lady Estelar Scan", "https://ladyestelarscan.com.br", "pt-BR"),
SingleLang("Lady Manga", "https://ladymanga.com", "en"),
SingleLang("Lala Manga", "https://lalamanga.com", "en", isNsfw = true),
SingleLang("Lara Manga", "https://laramanga.love", "en", overrideVersionCode = 1),
@ -387,6 +388,7 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("Painful Nightz Scan", "https://painfulnightz.com", "en", overrideVersionCode = 1),
SingleLang("Pantheon Scan", "https://pantheon-scan.com", "fr", overrideVersionCode = 1),
SingleLang("Paragon Scans", "https://paragonscans.com", "en", isNsfw = true),
SingleLang("Passa Mão Scan", "https://passamaoscan.com", "pt-BR", isNsfw = true, className = "PassaMaoScan"),
SingleLang("Paw Manga", "https://pawmanga.com", "en", isNsfw = true),
SingleLang("Petrotechsociety", "https://www.petrotechsociety.org", "en", isNsfw = true),
SingleLang("Pian Manga", "https://pianmanga.me", "en", isNsfw = true, overrideVersionCode = 1),