Fix everia.club (#11458)

* removed date bug

* ITS WORKING WOOOO

* update extVersionCode

* update as recommeneded
This commit is contained in:
sudocanttype 2022-04-14 08:43:09 +00:00 committed by GitHub
parent 5b70456840
commit 080ea8bdf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 7 deletions

2
.gitignore vendored
View File

@ -9,4 +9,4 @@ build/
repo/
apk/
gen
generated-src/
generated-src/

View File

@ -5,7 +5,7 @@ ext {
extName = 'Everia.club'
pkgNameSuffix = 'all.everiaclub'
extClass = '.EveriaClub'
extVersionCode = 1
extVersionCode = 2
isNsfw = true
}

View File

@ -63,7 +63,7 @@ class EveriaClub() : ParsedHttpSource() {
override fun mangaDetailsParse(document: Document): SManga {
val manga = SManga.create()
manga.title = document.select(".entry-title").text()
manga.description = document.select(".entry-content").text().trim()
manga.description = document.select(".entry-title").text()
val genres = mutableListOf<String>()
document.select(".nv-tags-list > a").forEach {
genres.add(it.text())
@ -74,10 +74,10 @@ class EveriaClub() : ParsedHttpSource() {
override fun chapterFromElement(element: Element): SChapter {
val chapter = SChapter.create()
chapter.setUrlWithoutDomain(element.select("meta[property=\"og:url\"]").attr("abs:content"))
chapter.setUrlWithoutDomain(element.select("link[rel=\"canonical\"]").attr("href"))
chapter.chapter_number = 0F
chapter.name = element.select(".entry-title").text()
chapter.date_upload = SimpleDateFormat("yyyy-MM-DD", Locale.US).parse(element.select("meta[property=\"article:published_time\"]").attr("abs:content").substringBeforeLast("T").substringAfterLast("/"))?.time ?: 0L
chapter.date_upload = getDate(element.select("link[rel=\"canonical\"]").attr("href"))
return chapter
}
@ -87,8 +87,8 @@ class EveriaClub() : ParsedHttpSource() {
override fun pageListParse(document: Document): List<Page> {
val pages = mutableListOf<Page>()
document.select(".entry-content img").forEachIndexed { i, it ->
val itUrl = it.attr("abs:src")
document.select(".wp-block-gallery img").forEachIndexed { i, it ->
val itUrl = it.attr("src")
pages.add(Page(i, itUrl, itUrl))
}
return pages
@ -109,4 +109,19 @@ class EveriaClub() : ParsedHttpSource() {
class TagFilter : Filter.Text("Tag")
private inline fun <reified T> Iterable<*>.findInstance() = find { it is T } as? T
private fun getDate(str: String): Long {
// At this point(4/12/22), this works with every everiaclub doc
val regex = "[0-9]{4}\\/[0-9]{2}\\/[0-9]{2}".toRegex()
val match = regex.find(str)
return runCatching { DATE_FORMAT.parse(match!!.value)?.time }
.getOrNull() ?: 0L
}
companion object {
private val DATE_FORMAT by lazy {
SimpleDateFormat("yyyy/MM/dd", Locale.US)
}
}
}