Manga-Raw.club: Added Chapter number (#11319)
* Manga-Raw.club: Added chapter number & Improved chapter date_upload * Manga-Raw.club: Resolved changes
This commit is contained in:
parent
28f3ee4008
commit
05330d0717
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'manga-raw.club'
|
extName = 'manga-raw.club'
|
||||||
pkgNameSuffix = 'en.mangarawclub'
|
pkgNameSuffix = 'en.mangarawclub'
|
||||||
extClass = '.MangaRawClub'
|
extClass = '.MangaRawClub'
|
||||||
extVersionCode = 8
|
extVersionCode = 9
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ import okhttp3.Request
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import java.text.ParseException
|
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
@ -34,7 +33,10 @@ class MangaRawClub : ParsedHttpSource() {
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val altName = "Alternative Name: "
|
private const val altName = "Alternative Name:"
|
||||||
|
|
||||||
|
private val DATE_FORMATTER by lazy { SimpleDateFormat("MMMMM dd, yyyy, h:mm a", Locale.ENGLISH) }
|
||||||
|
private val DATE_FORMATTER_2 by lazy { SimpleDateFormat("MMMMM dd, yyyy, h a", Locale.ENGLISH) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun popularMangaRequest(page: Int): Request {
|
override fun popularMangaRequest(page: Int): Request {
|
||||||
|
@ -111,27 +113,26 @@ class MangaRawClub : ParsedHttpSource() {
|
||||||
|
|
||||||
val name = element.select(".chapter-title").text().removeSuffix("-eng-li")
|
val name = element.select(".chapter-title").text().removeSuffix("-eng-li")
|
||||||
chapter.name = "Chapter $name"
|
chapter.name = "Chapter $name"
|
||||||
|
val number = parseChapterNumber(name)
|
||||||
|
if (number != null)
|
||||||
|
chapter.chapter_number = number
|
||||||
val date = parseChapterDate(element.select(".chapter-update").attr("datetime"))
|
val date = parseChapterDate(element.select(".chapter-update").attr("datetime"))
|
||||||
if (date != null)
|
|
||||||
chapter.date_upload = date
|
chapter.date_upload = date
|
||||||
return chapter
|
return chapter
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun parseChapterDate(date: String): Long? {
|
private fun parseChapterDate(string: String): Long {
|
||||||
if (date.isEmpty())
|
|
||||||
return null
|
|
||||||
// "April 21, 2021, 4:05 p.m."
|
// "April 21, 2021, 4:05 p.m."
|
||||||
val fdate = date.replace(".", "").replace("Sept", "Sep")
|
val date = string.replace(".", "").replace("Sept", "Sep")
|
||||||
return try {
|
return runCatching { DATE_FORMATTER.parse(date)?.time }.getOrNull()
|
||||||
try {
|
?: runCatching { DATE_FORMATTER_2.parse(date)?.time }.getOrNull() ?: 0L
|
||||||
SimpleDateFormat("MMMMM dd, yyyy, h:mm a", Locale.ENGLISH).parse(fdate)!!.time
|
|
||||||
} catch (e: ParseException) {
|
|
||||||
// because sometimes if it is exact hour it wont have minutes
|
|
||||||
SimpleDateFormat("MMMMM dd, yyyy, h a", Locale.ENGLISH).parse(fdate)!!.time
|
|
||||||
}
|
|
||||||
} catch (e: ParseException) {
|
|
||||||
null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun parseChapterNumber(string: String): Float? {
|
||||||
|
if (string.isEmpty())
|
||||||
|
return null
|
||||||
|
return string.split("-")[0].toFloatOrNull()
|
||||||
|
?: string.split(".")[0].toFloatOrNull()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
|
@ -142,7 +143,7 @@ class MangaRawClub : ParsedHttpSource() {
|
||||||
return pages
|
return pages
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun imageUrlParse(document: Document) = ""
|
override fun imageUrlParse(document: Document) = throw UnsupportedOperationException("Not used.")
|
||||||
|
|
||||||
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
|
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
|
||||||
val request = searchMangaRequest(page, query, filters)
|
val request = searchMangaRequest(page, query, filters)
|
||||||
|
|
Loading…
Reference in New Issue