MangaAlarb fix chapter names (#8564)

fix chapters names are are included with chapters date
This commit is contained in:
Ahmed gamal 2021-08-16 12:10:18 +02:00 committed by GitHub
parent 5edfbb5354
commit 4445b61ee8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'مانجا العرب'
pkgNameSuffix = 'ar.mangaalarab'
extClass = '.MangaAlarab'
extVersionCode = 3
extVersionCode = 4
libVersion = '1.2'
}

View File

@ -11,6 +11,9 @@ import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.Request
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import java.text.ParseException
import java.text.SimpleDateFormat
import java.util.Locale
class MangaAlarab : ParsedHttpSource() {
@ -123,11 +126,21 @@ class MangaAlarab : ParsedHttpSource() {
override fun chapterFromElement(element: Element): SChapter {
return SChapter.create().apply {
name = "${element.text()}"
name = "${element.select("div > span").text()}"
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
override fun pageListParse(document: Document): List<Page> {