diff --git a/src/en/dynasty/build.gradle b/src/en/dynasty/build.gradle index ff0455cc7..b75b8eb58 100644 --- a/src/en/dynasty/build.gradle +++ b/src/en/dynasty/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Dynasty' pkgNameSuffix = 'en.dynasty' extClass = '.DynastyFactory' - extVersionCode = 11 + extVersionCode = 12 libVersion = '1.2' } diff --git a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyChapters.kt b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyChapters.kt index b0f21796c..1ac7c34ed 100644 --- a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyChapters.kt +++ b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyChapters.kt @@ -5,8 +5,6 @@ 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 java.text.SimpleDateFormat -import java.util.Locale import okhttp3.Request import okhttp3.Response import org.jsoup.nodes.Document @@ -71,9 +69,7 @@ class DynastyChapters : DynastyScans() { val chapter = SChapter.create() chapter.setUrlWithoutDomain(element.baseUri()) chapter.name = element.select("h3").text() - chapter.date_upload = element.select("span.released")?.first().let { - SimpleDateFormat("MMM dd, yy", Locale.ENGLISH).parse(it!!.text()).time - } + chapter.date_upload = element.select("span.released").firstOrNull()?.text().toDate("MMM dd, yyyy") return chapter } diff --git a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyScans.kt b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyScans.kt index 8195874e8..8d4addde9 100644 --- a/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyScans.kt +++ b/src/en/dynasty/src/eu/kanade/tachiyomi/extension/en/dynasty/DynastyScans.kt @@ -147,12 +147,22 @@ abstract class DynastyScans : ParsedHttpSource() { chapter.name += " and ${nodes[nodes.indexOfPartial(" and ") + 1]}" } } - chapter.date_upload = nodes[nodes.indexOfPartial("released")].let { - SimpleDateFormat("MMM dd yy", Locale.ENGLISH).parse(it.substringAfter("released ").replace("\'", "")).time - } + chapter.date_upload = nodes[nodes.indexOfPartial("released")] + .substringAfter("released ") + .replace("\'", "") + .toDate("MMM dd yy") return chapter } + protected fun String?.toDate(pattern: String): Long { + this ?: return 0 + return try { + SimpleDateFormat(pattern, Locale.ENGLISH).parse(this)?.time ?: 0 + } catch (_: Exception) { + 0 + } + } + override fun pageListParse(document: Document): List { val pages = mutableListOf() try {