Move "DragonTranslation" to MangaThemesia and add "DragonTranslation.net" to Madara (#16191)

* Add DragonTranslation (unoriginal) and remove the dead one

* Remove unused override

* DragonTranslation is alive
This commit is contained in:
seew3l 2023-04-28 20:52:04 -05:00 committed by GitHub
parent ecc9196362
commit 2e2ca33445
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 111 additions and 29 deletions

View File

@ -1,25 +0,0 @@
package eu.kanade.tachiyomi.extension.es.dragontranslation
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.source.model.SChapter
import org.jsoup.nodes.Element
class DragonTranslation : Madara("DragonTranslation", "https://dragontranslation.com", "es") {
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.text().split(" ").dropLast(3).joinToString(" ")
}
chapter.date_upload = select("img").firstOrNull()?.attr("alt")?.let { parseRelativeDate(it) }
?: select("span a").firstOrNull()?.attr("title")?.let { parseRelativeDate(it) }
?: parseChapterDate(select("span.chapter-release-date i").firstOrNull()?.text())
}
return chapter
}
}

View File

Before

Width:  |  Height:  |  Size: 285 KiB

After

Width:  |  Height:  |  Size: 285 KiB

View File

@ -0,0 +1,90 @@
package eu.kanade.tachiyomi.extension.es.dragontranslationnet
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
class DragonTranslationNet : Madara("DragonTranslation.net", "https://dragontranslation.net", "es") {
override fun popularMangaRequest(page: Int): Request {
return GET("$baseUrl/mangas?page=$page", headers)
}
override fun popularMangaSelector() = "div:has(> div.series-card)"
override fun popularMangaNextPageSelector() = "li.page-item a[rel=next]"
override fun popularMangaFromElement(element: Element) = SManga.create().apply {
setUrlWithoutDomain(element.select("div.series-box a").attr("href"))
thumbnail_url = element.select("img.thumb-img").attr("abs:src")
title = element.select(".series-title").text()
}
override fun latestUpdatesRequest(page: Int): Request {
return GET(baseUrl, headers)
}
override fun latestUpdatesParse(response: Response): MangasPage {
val document = response.asJsoup()
val latestMangaContainer = document.selectFirst("div.d-flex:has(div.series-card)")
val mangaList = latestMangaContainer!!.select("> div").map { element ->
SManga.create().apply {
setUrlWithoutDomain(element.select("div.series-box a").attr("href"))
title = element.select(".series-title").text()
thumbnail_url = element.select("img.thumb-img").attr("abs:src")
}
}
return MangasPage(mangaList, false)
}
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = baseUrl.toHttpUrl().newBuilder()
.addPathSegment("mangas")
.addQueryParameter("buscar", query)
.addQueryParameter("page", page.toString())
return GET(url.build(), headers)
}
override fun searchMangaSelector() = popularMangaSelector()
override fun searchMangaFromElement(element: Element) = popularMangaFromElement(element)
override fun searchMangaNextPageSelector() = popularMangaNextPageSelector()
override fun getFilterList() = FilterList(emptyList())
override fun chapterFromElement(element: Element): SChapter {
val chapter = SChapter.create()
with(element) {
select(chapterUrlSelector).first()?.let { urlElement ->
chapter.url = urlElement.attr("abs:href")
chapter.name = urlElement.select("p.chapter-manhwa-title").text()
chapter.date_upload = parseChapterDate(select("span.chapter-release-date").text())
}
}
return chapter
}
override fun pageListParse(document: Document): List<Page> {
return document.select("div#chapter_imgs img").mapIndexed { index, element ->
Page(
index,
document.location(),
element.attr("abs:src"),
)
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 KiB

View File

@ -0,0 +1,13 @@
package eu.kanade.tachiyomi.extension.es.dragontranslation
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import java.text.SimpleDateFormat
import java.util.Locale
class DragonTranslation : MangaThemesia(
"DragonTranslation",
"https://dragontranslation.com",
"es",
mangaUrlDirectory = "/manga",
dateFormat = SimpleDateFormat("MMMM dd, yyyy", Locale("en")),
)

View File

@ -822,6 +822,9 @@ abstract class Madara(
WordSet("ago", "atrás", "önce", "قبل").endsWith(date) -> {
parseRelativeDate(date)
}
WordSet("hace").startsWith(date) -> {
parseRelativeDate(date)
}
date.contains(Regex("""\d(st|nd|rd|th)""")) -> {
// Clean date (e.g. 5th December 2019 to 5 December 2019) before parsing it
date.split(" ").map {
@ -848,9 +851,9 @@ abstract class Madara(
WordSet("jam", "saat", "heure", "hora", "hour", "ชั่วโมง", "giờ", "ore", "ساعة", "小时").anyWordIn(date) -> cal.apply { add(Calendar.HOUR, -number) }.timeInMillis
WordSet("menit", "dakika", "min", "minute", "minuto", "นาที", "دقائق").anyWordIn(date) -> cal.apply { add(Calendar.MINUTE, -number) }.timeInMillis
WordSet("detik", "segundo", "second", "วินาที").anyWordIn(date) -> cal.apply { add(Calendar.SECOND, -number) }.timeInMillis
WordSet("week").anyWordIn(date) -> cal.apply { add(Calendar.DAY_OF_MONTH, -number * 7) }.timeInMillis
WordSet("month").anyWordIn(date) -> cal.apply { add(Calendar.MONTH, -number) }.timeInMillis
WordSet("year").anyWordIn(date) -> cal.apply { add(Calendar.YEAR, -number) }.timeInMillis
WordSet("week", "semana").anyWordIn(date) -> cal.apply { add(Calendar.DAY_OF_MONTH, -number * 7) }.timeInMillis
WordSet("month", "mes").anyWordIn(date) -> cal.apply { add(Calendar.MONTH, -number) }.timeInMillis
WordSet("year", "año").anyWordIn(date) -> cal.apply { add(Calendar.YEAR, -number) }.timeInMillis
else -> 0
}
}

View File

@ -82,7 +82,7 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("Disaster Scans", "https://disasterscans.com", "en", overrideVersionCode = 2),
SingleLang("DokkoManga", "https://dokkomanga.xyz", "es"),
SingleLang("DoujinHentai", "https://doujinhentai.net", "es", isNsfw = true, overrideVersionCode = 1),
SingleLang("DragonTranslation", "https://dragontranslation.com", "es", isNsfw = true, overrideVersionCode = 4),
SingleLang("DragonTranslation.net", "https://dragontranslation.net", "es", isNsfw = true, className = "DragonTranslationNet"),
SingleLang("Drake Scans", "https://drakescans.com", "en", overrideVersionCode = 3),
SingleLang("Dream Manga", "https://www.swarmmanga.com", "en", overrideVersionCode = 3),
SingleLang("Drope Scan", "https://dropescan.com", "pt-BR", overrideVersionCode = 4),

View File

@ -31,6 +31,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
SingleLang("CosmicScans.id", "https://cosmicscans.id", "id", overrideVersionCode = 1, className = "CosmicScansID"),
SingleLang("Diskus Scan", "https://diskusscan.com", "pt-BR", overrideVersionCode = 7),
SingleLang("Dojing.net", "https://dojing.net", "id", isNsfw = true, className = "DojingNet"),
SingleLang("DragonTranslation", "https://dragontranslation.com", "es", isNsfw = true, overrideVersionCode = 9),
SingleLang("DuniaKomik.id", "https://duniakomik.id", "id", className = "DuniaKomikId"),
SingleLang("FlameScans.fr", "https://flamescans.fr", "fr", className = "FlameScansFR"),
SingleLang("Franxx Mangás", "https://franxxmangas.net", "pt-BR", className = "FranxxMangas", isNsfw = true),