Webtoons split (#6444)

* Create Webtoons.kt

* Added Webtoons Generator and translate

* Updated Vesion numbers

* Update WebtoonsTranslateGenerator.kt

* Added Icons and ovverides

* Removed non split files

* Update WebtoonsGenerator.kt

* Added id overrides for a few languages

* Added ID Override for  Indonesian

* Fixed backwards compability

* Fix backward compability
This commit is contained in:
Johannes Joens
2021-04-07 23:52:58 +12:00
committed by GitHub
parent 5cf8547ca9
commit a3b9c284de
23 changed files with 260 additions and 190 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -0,0 +1,59 @@
package eu.kanade.tachiyomi.extension.zh.dongmanmanhua
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.multisrc.webtoons.Webtoons
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.Headers
import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import java.text.SimpleDateFormat
import java.util.Locale
class DongmanManhua : Webtoons("Dongman Manhua", "https://www.dongmanmanhua.cn", "zh", "", dateFormat = SimpleDateFormat("yyyy-M-d", Locale.ENGLISH)) {
override fun headersBuilder(): Headers.Builder = super.headersBuilder()
.removeAll("Referer")
.add("Referer", baseUrl)
override fun popularMangaRequest(page: Int) = GET("$baseUrl/dailySchedule", headers)
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/dailySchedule?sortOrder=UPDATE&webtoonCompleteType=ONGOING", headers)
override fun parseDetailsThumbnail(document: Document): String? {
return document.select("div.detail_body").attr("style").substringAfter("(").substringBefore(")")
}
override fun chapterListRequest(manga: SManga): Request = GET(baseUrl + manga.url, headers)
override fun chapterListSelector() = "ul#_listUl li"
override fun chapterListParse(response: Response): List<SChapter> {
var document = response.asJsoup()
var continueParsing = true
val chapters = mutableListOf<SChapter>()
while (continueParsing) {
document.select(chapterListSelector()).map { chapters.add(chapterFromElement(it)) }
document.select("div.paginate a[onclick] + a").let { element ->
if (element.isNotEmpty()) document = client.newCall(GET(element.attr("abs:href"), headers)).execute().asJsoup()
else continueParsing = false
}
}
return chapters
}
override fun chapterFromElement(element: Element): SChapter {
return SChapter.create().apply {
name = element.select("span.subj span").text()
url = element.select("a").attr("href").substringAfter(".cn")
date_upload = chapterParseDate(element.select("span.date").text())
}
}
override fun getFilterList(): FilterList = FilterList()
}

View File

@ -0,0 +1,56 @@
package eu.kanade.tachiyomi.extension.all.webtoons
import eu.kanade.tachiyomi.multisrc.webtoons.Webtoons
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceFactory
import java.text.SimpleDateFormat
import java.util.GregorianCalendar
import java.util.Locale
import java.util.Calendar
class WebtoonsFactory : SourceFactory {
override fun createSources(): List<Source> = listOf(
WebtoonsEN(),
WebtoonsID(),
WebtoonsTH(),
WebtoonsES(),
WebtoonsFR(),
WebtoonsZH(),
)
}
class WebtoonsEN : Webtoons("Webtoons", "https://www.webtoons.com", "en")
class WebtoonsID : Webtoons("Webtoons", "https://www.webtoons.com", "id") {
// Override ID as part of the name was removed to be more consiten with other enteries
override val id: Long = 8749627068478740298
// Android seems to be unable to parse Indonesian dates; we'll use a short hard-coded table
// instead.
private val dateMap: Array<String> = arrayOf(
"Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agu", "Sep", "Okt", "Nov", "Des"
)
override fun chapterParseDate(date: String): Long {
val expr = Regex("""(\d{4}) ([A-Z][a-z]{2}) (\d+)""").find(date) ?: return 0
val (_, year, monthString, day) = expr.groupValues
val monthIndex = dateMap.indexOf(monthString)
return GregorianCalendar(year.toInt(), monthIndex, day.toInt()).time.time
}
}
class WebtoonsTH : Webtoons("Webtoons", "https://www.webtoons.com", "th", dateFormat = SimpleDateFormat("d MMM yyyy", Locale("th")))
class WebtoonsES : Webtoons("Webtoons", "https://www.webtoons.com", "es") {
// Android seems to be unable to parse es dates like Indonesian; we'll use a short hard-coded table
// instead.
private val dateMap: Array<String> = arrayOf(
"Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"
)
override fun chapterParseDate(date: String): Long {
val expr = Regex("""(\d+)-([a-z]{3})-(\d{4})""").find(date) ?: return 0
val (_, day, monthString, year) = expr.groupValues
val monthIndex = dateMap.indexOf(monthString)
return GregorianCalendar(year.toInt(), monthIndex, day.toInt()).time.time
}
}
class WebtoonsFR : Webtoons("Webtoons", "https://www.webtoons.com", "fr", dateFormat = SimpleDateFormat("d MMM yyyy", Locale.FRENCH))
class WebtoonsZH : Webtoons("Webtoons", "https://www.webtoons.com", "zh", "zh-hant", "zh_TW", SimpleDateFormat("yyyy/MM/dd", Locale.TRADITIONAL_CHINESE))

View File

@ -0,0 +1,85 @@
package eu.kanade.tachiyomi.extension.all.webtoonstranslate
import eu.kanade.tachiyomi.multisrc.webtoons.WebtoonsTranslate
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceFactory
class WebtoonsTranslateFactory : SourceFactory {
override fun createSources(): List<Source> = listOf(
WebtoonsTranslateEN(),
WebtoonsTranslateZH_CMN(),
WebtoonsTranslateZH_CMY(),
WebtoonsTranslateTH(),
WebtoonsTranslateID(),
WebtoonsTranslateFR(),
WebtoonsTranslateVI(),
WebtoonsTranslateRU(),
WebtoonsTranslateAR(),
WebtoonsTranslateFIL(),
WebtoonsTranslateDE(),
WebtoonsTranslateHI(),
WebtoonsTranslateIT(),
WebtoonsTranslateJA(),
WebtoonsTranslatePT_POR(),
WebtoonsTranslateTR(),
WebtoonsTranslateMS(),
WebtoonsTranslatePL(),
WebtoonsTranslatePT_POT(),
WebtoonsTranslateBG(),
WebtoonsTranslateDA(),
WebtoonsTranslateNL(),
WebtoonsTranslateRO(),
WebtoonsTranslateMN(),
WebtoonsTranslateEL(),
WebtoonsTranslateLT(),
WebtoonsTranslateCS(),
WebtoonsTranslateSV(),
WebtoonsTranslateBN(),
WebtoonsTranslateFA(),
WebtoonsTranslateUK(),
WebtoonsTranslateES(),
)
}
class WebtoonsTranslateEN : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "en", "ENG")
class WebtoonsTranslateZH_CMN : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "zh-hans", "CMN"){
override val id: Long = 5196522547754842244
}
class WebtoonsTranslateZH_CMY : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "zh-hant", "CMT"){
override val id: Long = 1016181401146312893
}
class WebtoonsTranslateTH : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "th", "THA")
class WebtoonsTranslateID : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "id", "IND")
class WebtoonsTranslateFR : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "fr", "FRA")
class WebtoonsTranslateVI : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "vi", "VIE")
class WebtoonsTranslateRU : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "ru", "RUS")
class WebtoonsTranslateAR : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "ar", "ARA")
class WebtoonsTranslateFIL : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "fil", "FIL")
class WebtoonsTranslateDE : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "de", "DEU")
class WebtoonsTranslateHI : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "hi", "HIN")
class WebtoonsTranslateIT : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "it", "ITA")
class WebtoonsTranslateJA : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "ja", "JPN")
class WebtoonsTranslatePT_POR : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "pt-br", "POR"){
//Changed languge code from pt to pt-br
override val id: Long = 275670196689829558
}
class WebtoonsTranslateTR : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "tr", "TUR")
class WebtoonsTranslateMS : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "ms", "MAY")
class WebtoonsTranslatePL : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "pl", "POL")
class WebtoonsTranslatePT_POT : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "pt", "POT") {
override val id: Long = 9219933036054791613
}
class WebtoonsTranslateBG : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "bg", "BUL")
class WebtoonsTranslateDA : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "da", "DAN")
class WebtoonsTranslateNL : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "nl", "NLD")
class WebtoonsTranslateRO : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "ro", "RON")
class WebtoonsTranslateMN : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "mn", "MON")
class WebtoonsTranslateEL : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "el", "GRE")
class WebtoonsTranslateLT : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "lt", "LIT")
class WebtoonsTranslateCS : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "cs", "CES")
class WebtoonsTranslateSV : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "sv", "SWE")
class WebtoonsTranslateBN : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "bn", "BEN")
class WebtoonsTranslateFA : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "fa", "PER")
class WebtoonsTranslateUK : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "uk", "UKR")
class WebtoonsTranslateES : WebtoonsTranslate("Webtoons.com Translations", "https://translate.webtoons.com", "es", "SPA")