Rawkuma - Date Fix v2 (#2081)

Rawkuma - Date Fix v2
This commit is contained in:
happywillow0 2020-01-18 02:12:20 -05:00 committed by arkon
parent ff75221350
commit 7bc1218b95
2 changed files with 7 additions and 9 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: Rawkuma'
pkgNameSuffix = 'ja.rawkuma'
extClass = '.Rawkuma'
extVersionCode = 2
extVersionCode = 3
libVersion = '1.2'
}

View File

@ -156,22 +156,20 @@ class Rawkuma: ParsedHttpSource() {
val chapters = mutableListOf<SChapter>()
document.select(chapterListSelector()).map { chapters.add(chapterFromElement(it)) }
// Add date for latest chapter only
document.select("time[itemprop=dateModified]").attr("datetime")
.let { chapters[0].date_upload = parseDate(it) }
document.select("time[itemprop=dateModified]").text()
.let {
chapters[0].date_upload = parseDate(it)
}
return chapters
}
private fun parseDate(date: String): Long {
return try {
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.US).parse(date).time
} catch (e: ParseException) {
try {
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US).parse(date.substringBefore("+")).time
SimpleDateFormat("MMM dd, yyyy", Locale.US).parse(date).time
} catch (e: ParseException) {
0L
}
}
}
override fun chapterListSelector() = ".lchx"