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' appName = 'Tachiyomi: Rawkuma'
pkgNameSuffix = 'ja.rawkuma' pkgNameSuffix = 'ja.rawkuma'
extClass = '.Rawkuma' extClass = '.Rawkuma'
extVersionCode = 2 extVersionCode = 3
libVersion = '1.2' libVersion = '1.2'
} }

View File

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