Fix some Thai Madara source (#11703)

* Clean up code and disable NonMangaItems Filter

* Clean up code and disable NonMangaItems Filter

* Clean up code and Change baseUrl

* Fix Url problem

* Change requests url due to inaccessibility of the admin-ajax.php page

* Clean up code and disable NonMangaItems Filter

Clean up code and disable NonMangaItems Filter

Clean up code and Change baseUrl

Fix Url problem

Change requests url due to inaccessibility of the admin-ajax.php page
This commit is contained in:
Promchai Chooseang 2022-05-03 04:34:35 +07:00 committed by GitHub
parent 440168ca7b
commit 533eec004d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 32 deletions

View File

@ -1,16 +1,33 @@
package eu.kanade.tachiyomi.extension.th.cattranslator
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.network.POST
import okhttp3.CacheControl
import okhttp3.Request
import eu.kanade.tachiyomi.source.model.SManga
import org.jsoup.nodes.Element
class CatTranslator : Madara("CAT-translator", "https://cat-translator.com", "th") {
override fun popularMangaRequest(page: Int): Request =
POST("$baseUrl/manga/wp-admin/admin-ajax.php", formHeaders, formBuilder(page, true).build(), CacheControl.FORCE_NETWORK)
class CatTranslator : Madara(
"CAT-translator",
"https://cats-translator.com/manga",
"th"
) {
private fun parseMangaFromElement(element: Element, isSearch: Boolean): SManga {
val manga = SManga.create()
override fun latestUpdatesRequest(page: Int): Request =
POST("$baseUrl/manga/wp-admin/admin-ajax.php", formHeaders, formBuilder(page, false).build(), CacheControl.FORCE_NETWORK)
with(element) {
select(if (isSearch) "div.post-title a" else popularMangaUrlSelector).first()?.let {
manga.setUrlWithoutDomain(it.attr("abs:href"))
manga.url = manga.url.removePrefix("/manga")
manga.title = it.ownText()
}
override fun searchPage(page: Int): String = "manga/page/$page/"
select("img").first()?.let {
manga.thumbnail_url = imageFromElement(it)
}
}
return manga
}
override fun popularMangaFromElement(element: Element) = parseMangaFromElement(element, false)
override fun searchMangaFromElement(element: Element) = parseMangaFromElement(element, true)
}

View File

@ -1,7 +1,17 @@
package eu.kanade.tachiyomi.extension.th.mangadeemak
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.network.GET
import okhttp3.Request
import java.text.SimpleDateFormat
import java.util.Locale
class MangaDeemak : Madara("MangaDeemak", "https://mangadeemak.com", "th", SimpleDateFormat("d MMMM yyyy", Locale("th")))
class MangaDeemak : Madara("MangaDeemak", "https://mangadeemak.com", "th", SimpleDateFormat("d MMMM yyyy", Locale("th"))) {
override fun popularMangaRequest(page: Int): Request {
return GET("$baseUrl/manga/page/$page/?m_orderby=trending", headers)
}
override fun latestUpdatesRequest(page: Int): Request {
return GET("$baseUrl/manga/page/$page/", headers)
}
}

View File

@ -1,27 +1,9 @@
package eu.kanade.tachiyomi.extension.th.rh2plusmanga
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.source.model.Page
import org.jsoup.nodes.Document
import java.text.SimpleDateFormat
import java.util.Locale
class Rh2PlusManga : Madara("Rh2PlusManga", "https://www.rh2plusmanga.com", "th", SimpleDateFormat("d MMMM yyyy", Locale("th"))) {
override val useNewChapterEndpoint = true
override val pageListParseSelector = "div.reading-content p code img"
override fun pageListParse(document: Document): List<Page> {
countViews(document)
return document.select(pageListParseSelector).mapIndexed { index, element ->
Page(
index,
document.location(),
element.let {
it.absUrl(if (it.hasAttr("data-src")) "data-src" else "src")
}
)
}
}
override val filterNonMangaItems = false
}

View File

@ -60,7 +60,7 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("BlogManga", "https://blogmanga.net", "en"),
SingleLang("Boruto Explorer", "https://leitor.borutoexplorer.com.br", "pt-BR", overrideVersionCode = 1),
SingleLang("BoysLove", "https://boyslove.me", "en", overrideVersionCode = 2),
SingleLang("CAT-translator", "https://cat-translator.com", "th", className = "CatTranslator", overrideVersionCode = 1),
SingleLang("CAT-translator", "https://cats-translator.com/manga", "th", className = "CatTranslator", overrideVersionCode = 2),
SingleLang("Café com Yaoi", "http://cafecomyaoi.com.br", "pt-BR", pkgName = "cafecomyaoi", className = "CafeComYaoi", isNsfw = true, overrideVersionCode = 1),
SingleLang("Cat300", "https://cat300.com", "th", isNsfw = true, className = "Cat300", overrideVersionCode = 1),
SingleLang("CatOnHeadTranslations", "https://catonhead.com", "en", overrideVersionCode = 2),
@ -232,7 +232,7 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("MangaCV", "https://mangacv.com", "en", isNsfw = true),
SingleLang("MangaClash", "https://mangaclash.com", "en", overrideVersionCode = 3),
SingleLang("MangaCultivator", "https://mangacultivator.com", "en", overrideVersionCode = 2),
SingleLang("MangaDeemak", "https://mangadeemak.com", "th"),
SingleLang("MangaDeemak", "https://mangadeemak.com", "th", overrideVersionCode = 2),
SingleLang("MangaDods", "https://www.mangadods.com", "en", overrideVersionCode = 2),
SingleLang("MangaDol", "https://mangadol.com", "en"),
SingleLang("MangaDrago", "https://mangadrago.com", "en"),
@ -378,7 +378,7 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("Remoscans", "https://remoscans.xyz", "en"),
SingleLang("Renascence Scans (Renascans)", "https://new.renascans.com", "en", className = "RenaScans", overrideVersionCode = 1),
SingleLang("Reset Scans", "https://reset-scans.com", "en", overrideVersionCode = 5),
SingleLang("Rh2PlusManga", "https://www.rh2plusmanga.com", "th", overrideVersionCode = 3),
SingleLang("Rh2PlusManga", "https://www.rh2plusmanga.com", "th", overrideVersionCode = 4),
SingleLang("Rüya Manga", "https://www.ruyamanga.com", "tr", className = "RuyaManga", overrideVersionCode = 1),
SingleLang("RWBY Scan", "https://rwbyscan.site", "pt-BR", isNsfw = true, className = "RwbyScan"),
SingleLang("S2Manga", "https://s2manga.com", "en", overrideVersionCode = 1),