Update Manga-raw.club (#7254)

* [EN] manga-raw.club extension implementation

* Added nsfw tag

* Change to get correct description and if date parse fails returns 0

* update extension version number

* Date is now parsed always with English Locale

* Fixed Status to show correctly
This commit is contained in:
NMBLM 2021-05-27 17:47:16 +01:00 committed by GitHub
parent a603e15b50
commit a5836c534b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 17 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'manga-raw.club'
pkgNameSuffix = 'en.mangarawclub'
extClass = '.MangaRawClub'
extVersionCode = 1
extVersionCode = 2
libVersion = '1.2'
containsNsfw = true
}

View File

@ -84,21 +84,20 @@ class MangaRawClub : ParsedHttpSource() {
genres.add(genre)
}
manga.genre = genres.joinToString(", ")
manga.status = parseStatus(document.select("h5:contains(Status) + div").text())
val status = when {
document.select("div.header-stats").select("strong.completed").first() != null -> SManga.COMPLETED
document.select("div.header-stats").select("strong.ongoing").first() != null -> SManga.ONGOING
else -> SManga.UNKNOWN
}
manga.status = status
manga.description = document.getElementsByClass("description").first().text()
manga.description = document.select("div.summary > div.content").first().text()
val coverElement = document.getElementsByClass("cover")
manga.thumbnail_url = baseUrl + coverElement.select("img").attr("data-src")
return manga
}
private fun parseStatus(element: String): Int = when {
element.toLowerCase(Locale.getDefault()).contains("publishing") -> SManga.ONGOING
element.toLowerCase(Locale.getDefault()).contains("finished") -> SManga.COMPLETED
else -> SManga.UNKNOWN
}
override fun chapterListSelector() = "ul.chapter-list > li"
override fun chapterFromElement(element: Element): SChapter {
@ -117,16 +116,19 @@ class MangaRawClub : ParsedHttpSource() {
val fdate = date.replace(".", "").replace("Sept", "Sep")
val format = "MMMMM dd, yyyy, h:mm a"
val format2 = "MMMMM dd, yyyy, h a" // because sometimes if it is exact hour it wont have minutes because why not
val sdf = SimpleDateFormat(format)
val sdf = SimpleDateFormat(format, Locale.ENGLISH)
try {
return try {
val value = sdf.parse(fdate)
value!!.time
} catch (e: ParseException) {
val sdfF = SimpleDateFormat(format2)
val sdfF = SimpleDateFormat(format2, Locale.ENGLISH)
val value = sdfF.parse(fdate)
value!!.time
}
} catch (e: ParseException) {
return 0
}
}
override fun pageListParse(document: Document): List<Page> {