RainOfSnow: fix duplicate entries, add chapter timestamp (#6185)
* fix duplicate entries * add chapter time stamp
This commit is contained in:
parent
e049f285ec
commit
56a48bf213
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'Rain Of Snow'
|
||||
pkgNameSuffix = 'en.rainofsnow'
|
||||
extClass = '.RainOfSnow'
|
||||
extVersionCode = 3
|
||||
extVersionCode = 4
|
||||
libVersion = '1.2'
|
||||
containsNsfw = false
|
||||
}
|
||||
|
|
|
@ -12,6 +12,9 @@ import okhttp3.Request
|
|||
import okhttp3.Response
|
||||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
import java.text.ParseException
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
open class RainOfSnow() : ParsedHttpSource() {
|
||||
|
@ -30,7 +33,7 @@ open class RainOfSnow() : ParsedHttpSource() {
|
|||
.build()
|
||||
|
||||
override fun popularMangaRequest(page: Int): Request {
|
||||
return GET("$baseUrl/comic/")
|
||||
return GET("$baseUrl/comics-library/page/$page")
|
||||
}
|
||||
|
||||
override fun popularMangaSelector() = "ul.boxhover1 li"
|
||||
|
@ -94,9 +97,19 @@ open class RainOfSnow() : ParsedHttpSource() {
|
|||
val chapter = SChapter.create()
|
||||
chapter.url = element.select("a").attr("abs:href")
|
||||
chapter.name = element.select("a").text()
|
||||
chapter.date_upload = element.select("small").firstOrNull()?.text()
|
||||
?.let { parseChapterDate(it) } ?: 0
|
||||
return chapter
|
||||
}
|
||||
|
||||
private fun parseChapterDate(date: String): Long {
|
||||
var parsedDate = 0L
|
||||
try {
|
||||
parsedDate = SimpleDateFormat("MMM dd, yyyy", Locale.US).parse(date)?.time ?: 0L
|
||||
} catch (e: ParseException) { /*nothing to do, parsedDate is initialized with 0L*/ }
|
||||
return parsedDate
|
||||
}
|
||||
|
||||
override fun pageListRequest(chapter: SChapter): Request {
|
||||
if (chapter.url.startsWith("http")) {
|
||||
return GET(chapter.url, headers)
|
||||
|
|
Loading…
Reference in New Issue