MangaAlarb fix chapter names (#8564)
fix chapters names are are included with chapters date
This commit is contained in:
parent
5edfbb5354
commit
4445b61ee8
@ -5,7 +5,7 @@ ext {
|
|||||||
extName = 'مانجا العرب'
|
extName = 'مانجا العرب'
|
||||||
pkgNameSuffix = 'ar.mangaalarab'
|
pkgNameSuffix = 'ar.mangaalarab'
|
||||||
extClass = '.MangaAlarab'
|
extClass = '.MangaAlarab'
|
||||||
extVersionCode = 3
|
extVersionCode = 4
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,9 @@ import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
|||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
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
|
||||||
|
|
||||||
class MangaAlarab : ParsedHttpSource() {
|
class MangaAlarab : ParsedHttpSource() {
|
||||||
|
|
||||||
@ -123,11 +126,21 @@ class MangaAlarab : ParsedHttpSource() {
|
|||||||
|
|
||||||
override fun chapterFromElement(element: Element): SChapter {
|
override fun chapterFromElement(element: Element): SChapter {
|
||||||
return SChapter.create().apply {
|
return SChapter.create().apply {
|
||||||
name = "${element.text()}"
|
name = "${element.select("div > span").text()}"
|
||||||
setUrlWithoutDomain(element.attr("href"))
|
setUrlWithoutDomain(element.attr("href"))
|
||||||
|
date_upload = element.select("div > time").firstOrNull()?.text()
|
||||||
|
?.let { parseChapterDate(it) } ?: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun parseChapterDate(date: String): Long {
|
||||||
|
var parsedDate = 0L
|
||||||
|
try {
|
||||||
|
parsedDate = SimpleDateFormat("yyyy-MM-dd", Locale.US).parse(date)?.time ?: 0L
|
||||||
|
} catch (e: ParseException) { /*nothing to do, parsedDate is initialized with 0L*/ }
|
||||||
|
return parsedDate
|
||||||
|
}
|
||||||
|
|
||||||
// Pages
|
// Pages
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user