Webtoons - add French webtoons (#4220)

This commit is contained in:
Mike 2020-08-27 03:50:23 -04:00 committed by GitHub
parent ddc9d8b10a
commit d4d1cc0e99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 19 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Webtoons' extName = 'Webtoons'
pkgNameSuffix = 'all.webtoons' pkgNameSuffix = 'all.webtoons'
extClass = '.WebtoonsFactory' extClass = '.WebtoonsFactory'
extVersionCode = 18 extVersionCode = 19
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -13,7 +13,7 @@ import okhttp3.Response
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
class DongmanManhua : WebtoonsDefault("zh", "") { class DongmanManhua : WebtoonsDefault("zh", "", dateFormat = SimpleDateFormat("yyyy-M-d", Locale.ENGLISH)) {
override val baseUrl = "https://www.dongmanmanhua.cn" override val baseUrl = "https://www.dongmanmanhua.cn"
override val name = "Dongman Manhua" override val name = "Dongman Manhua"
@ -57,9 +57,5 @@ class DongmanManhua : WebtoonsDefault("zh", "") {
} }
} }
override fun chapterParseDate(date: String): Long {
return SimpleDateFormat("yyyy-M-d", Locale.ENGLISH).parse(date).time
}
override fun getFilterList(): FilterList = FilterList() override fun getFilterList(): FilterList = FilterList()
} }

View File

@ -68,7 +68,7 @@ abstract class Webtoons(
override fun popularMangaSelector() = "not using" override fun popularMangaSelector() = "not using"
override fun latestUpdatesSelector() = "div#dailyList > $day li > a:has(span:contains(UP))" override fun latestUpdatesSelector() = "div#dailyList > $day li > a"
override fun headersBuilder(): Headers.Builder = super.headersBuilder() override fun headersBuilder(): Headers.Builder = super.headersBuilder()
.add("Referer", "https://www.webtoons.com/$langCode/") .add("Referer", "https://www.webtoons.com/$langCode/")

View File

@ -13,7 +13,8 @@ import org.jsoup.nodes.Element
open class WebtoonsDefault( open class WebtoonsDefault(
override val lang: String, override val lang: String,
override val langCode: String = lang, override val langCode: String = lang,
override val localeForCookie: String = lang override val localeForCookie: String = lang,
private val dateFormat: SimpleDateFormat = SimpleDateFormat("MMM d, yyyy", Locale.ENGLISH)
) : Webtoons(lang, langCode, lang) { ) : Webtoons(lang, langCode, lang) {
override fun chapterListSelector() = "ul#_episodeList > li[id*=episode]" override fun chapterListSelector() = "ul#_episodeList > li[id*=episode]"
@ -36,7 +37,7 @@ open class WebtoonsDefault(
} }
open fun chapterParseDate(date: String): Long { open fun chapterParseDate(date: String): Long {
return SimpleDateFormat("MMM d, yyyy", Locale.ENGLISH).parse(date).time return dateFormat.parse(date)?.time ?: 0
} }
override fun chapterListRequest(manga: SManga) = GET("https://m.webtoons.com" + manga.url, mobileHeaders) override fun chapterListRequest(manga: SManga) = GET("https://m.webtoons.com" + manga.url, mobileHeaders)

View File

@ -12,6 +12,7 @@ class WebtoonsFactory : SourceFactory {
WebtoonsChineseTraditional(), WebtoonsChineseTraditional(),
WebtoonsIndonesian(), WebtoonsIndonesian(),
WebtoonsThai(), WebtoonsThai(),
WebtoonsFr(),
DongmanManhua(), DongmanManhua(),
// Fan translations // Fan translations
@ -67,14 +68,8 @@ class WebtoonsIndonesian : WebtoonsDefault("in", "id") {
} }
} }
class WebtoonsThai : WebtoonsDefault("th") { class WebtoonsThai : WebtoonsDefault("th", dateFormat = SimpleDateFormat("d MMM yyyy", Locale("th")))
override fun chapterParseDate(date: String): Long {
return SimpleDateFormat("d MMM yyyy", Locale("th")).parse(date).time
}
}
class WebtoonsChineseTraditional : WebtoonsDefault("zh", "zh-hant", "zh_TW") { class WebtoonsChineseTraditional : WebtoonsDefault("zh", "zh-hant", "zh_TW", SimpleDateFormat("yyyy/MM/dd", Locale.TRADITIONAL_CHINESE))
override fun chapterParseDate(date: String): Long {
return SimpleDateFormat("yyyy/MM/dd", Locale.TRADITIONAL_CHINESE).parse(date).time class WebtoonsFr : WebtoonsDefault("fr", dateFormat = SimpleDateFormat("d MMM yyyy", Locale.FRENCH))
}
}