From f48cf6e23f39693d496ed6b130fcc6727a64aa7c Mon Sep 17 00:00:00 2001 From: mobi2002 <48650614+mobi2002@users.noreply.github.com> Date: Sat, 4 Feb 2023 21:41:20 +0500 Subject: [PATCH] Comick: fix date parsing (#15232) --- src/all/comickfun/build.gradle | 2 +- .../tachiyomi/extension/all/comickfun/ComickFun.kt | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/all/comickfun/build.gradle b/src/all/comickfun/build.gradle index 866567eb2..35e8081c8 100644 --- a/src/all/comickfun/build.gradle +++ b/src/all/comickfun/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Comick' pkgNameSuffix = 'all.comickfun' extClass = '.ComickFunFactory' - extVersionCode = 19 + extVersionCode = 20 isNsfw = true } diff --git a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt index f5d2b7e74..4262d3229 100644 --- a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt +++ b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt @@ -19,7 +19,9 @@ import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.Response import rx.Observable +import java.text.ParseException import java.text.SimpleDateFormat +import java.util.Locale const val API_BASE = "https://api.comick.fun" @@ -260,14 +262,20 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S SChapter.create().apply { url = "/comic/${mangaData.comic.slug}/${chapter.hid}-chapter-${chapter.chap}-$comickFunLang" name = beautifyChapterName(chapter.vol, chapter.chap, chapter.title) - date_upload = DATE_FORMATTER.parse(chapter.created_at)!!.time + date_upload = chapter.created_at.let { + try { + DATE_FORMATTER.parse(it)?.time ?: 0L + } catch (e: ParseException) { + 0L + } + } scanlator = chapter.group_name.joinToString().takeUnless { it.isBlank() } } } } private val DATE_FORMATTER by lazy { - SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZZZZ") + SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ENGLISH) } /** Chapter Pages **/