Comick: fix date parsing (#15232)

This commit is contained in:
mobi2002 2023-02-04 21:41:20 +05:00 committed by GitHub
parent 9d9d26576c
commit f48cf6e23f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Comick'
pkgNameSuffix = 'all.comickfun'
extClass = '.ComickFunFactory'
extVersionCode = 19
extVersionCode = 20
isNsfw = true
}

View File

@ -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 **/