Dynasty - fix date parsing (#4137)
This commit is contained in:
parent
8b3c2cc12f
commit
eff8246ee1
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'Dynasty'
|
||||
pkgNameSuffix = 'en.dynasty'
|
||||
extClass = '.DynastyFactory'
|
||||
extVersionCode = 11
|
||||
extVersionCode = 12
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Page> {
|
||||
val pages = mutableListOf<Page>()
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue