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'
|
extName = 'Rain Of Snow'
|
||||||
pkgNameSuffix = 'en.rainofsnow'
|
pkgNameSuffix = 'en.rainofsnow'
|
||||||
extClass = '.RainOfSnow'
|
extClass = '.RainOfSnow'
|
||||||
extVersionCode = 3
|
extVersionCode = 4
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
containsNsfw = false
|
containsNsfw = false
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,9 @@ import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
import java.text.ParseException
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Locale
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
open class RainOfSnow() : ParsedHttpSource() {
|
open class RainOfSnow() : ParsedHttpSource() {
|
||||||
|
@ -30,7 +33,7 @@ open class RainOfSnow() : ParsedHttpSource() {
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
override fun popularMangaRequest(page: Int): Request {
|
override fun popularMangaRequest(page: Int): Request {
|
||||||
return GET("$baseUrl/comic/")
|
return GET("$baseUrl/comics-library/page/$page")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun popularMangaSelector() = "ul.boxhover1 li"
|
override fun popularMangaSelector() = "ul.boxhover1 li"
|
||||||
|
@ -94,9 +97,19 @@ open class RainOfSnow() : ParsedHttpSource() {
|
||||||
val chapter = SChapter.create()
|
val chapter = SChapter.create()
|
||||||
chapter.url = element.select("a").attr("abs:href")
|
chapter.url = element.select("a").attr("abs:href")
|
||||||
chapter.name = element.select("a").text()
|
chapter.name = element.select("a").text()
|
||||||
|
chapter.date_upload = element.select("small").firstOrNull()?.text()
|
||||||
|
?.let { parseChapterDate(it) } ?: 0
|
||||||
return chapter
|
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 {
|
override fun pageListRequest(chapter: SChapter): Request {
|
||||||
if (chapter.url.startsWith("http")) {
|
if (chapter.url.startsWith("http")) {
|
||||||
return GET(chapter.url, headers)
|
return GET(chapter.url, headers)
|
||||||
|
|
Loading…
Reference in New Issue