From 72b25fbd4b5c70affe8ca90ede512af5f67f1737 Mon Sep 17 00:00:00 2001 From: Mike <51273546+SnakeDoc83@users.noreply.github.com> Date: Wed, 29 Jan 2020 07:35:26 -0500 Subject: [PATCH] ReadComicOnline - latest updates fix (#2149) --- src/en/readcomiconline/build.gradle | 2 +- .../en/readcomiconline/Readcomiconline.kt | 20 +++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/en/readcomiconline/build.gradle b/src/en/readcomiconline/build.gradle index 2c98f535a..f3864a149 100644 --- a/src/en/readcomiconline/build.gradle +++ b/src/en/readcomiconline/build.gradle @@ -5,7 +5,7 @@ ext { appName = 'Tachiyomi: ReadComicOnline' pkgNameSuffix = 'en.readcomiconline' extClass = '.Readcomiconline' - extVersionCode = 6 + extVersionCode = 7 libVersion = '1.2' } diff --git a/src/en/readcomiconline/src/eu/kanade/tachiyomi/extension/en/readcomiconline/Readcomiconline.kt b/src/en/readcomiconline/src/eu/kanade/tachiyomi/extension/en/readcomiconline/Readcomiconline.kt index be02105f5..7bb21e7c0 100644 --- a/src/en/readcomiconline/src/eu/kanade/tachiyomi/extension/en/readcomiconline/Readcomiconline.kt +++ b/src/en/readcomiconline/src/eu/kanade/tachiyomi/extension/en/readcomiconline/Readcomiconline.kt @@ -4,7 +4,6 @@ import android.app.Application import android.content.SharedPreferences import android.support.v7.preference.ListPreference import android.support.v7.preference.PreferenceScreen -import android.util.Log import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.source.ConfigurableSource @@ -19,6 +18,7 @@ import org.jsoup.nodes.Element import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.text.SimpleDateFormat +import java.util.Locale import java.util.regex.Pattern class Readcomiconline : ConfigurableSource, ParsedHttpSource() { @@ -37,9 +37,9 @@ class Readcomiconline : ConfigurableSource, ParsedHttpSource() { Injekt.get().getSharedPreferences("source_$id", 0x0000) } - override fun popularMangaSelector() = "table.listing tr:gt(1)" + override fun popularMangaSelector() = "table.listing tr:has(a) td:nth-child(1) a" - override fun latestUpdatesSelector() = "table.listing tr:gt(1)" + override fun latestUpdatesSelector() = popularMangaSelector() override fun popularMangaRequest(page: Int): Request { return GET("$baseUrl/ComicList/MostPopular?page=$page", headers) @@ -50,12 +50,10 @@ class Readcomiconline : ConfigurableSource, ParsedHttpSource() { } override fun popularMangaFromElement(element: Element): SManga { - val manga = SManga.create() - element.select("td a:eq(0)").first().let { - manga.setUrlWithoutDomain(it.attr("href")) - manga.title = it.text() + return SManga.create().apply { + setUrlWithoutDomain(element.attr("href")) + title = element.text() } - return manga } override fun latestUpdatesFromElement(element: Element): SManga { @@ -87,7 +85,7 @@ class Readcomiconline : ConfigurableSource, ParsedHttpSource() { return popularMangaFromElement(element) } - override fun searchMangaNextPageSelector() = null + override fun searchMangaNextPageSelector(): String? = null override fun mangaDetailsParse(document: Document): SManga { val infoElement = document.select("div.barContent").first() @@ -102,7 +100,7 @@ class Readcomiconline : ConfigurableSource, ParsedHttpSource() { return manga } - fun parseStatus(status: String) = when { + private fun parseStatus(status: String) = when { status.contains("Ongoing") -> SManga.ONGOING status.contains("Completed") -> SManga.COMPLETED else -> SManga.UNKNOWN @@ -117,7 +115,7 @@ class Readcomiconline : ConfigurableSource, ParsedHttpSource() { chapter.setUrlWithoutDomain(urlElement.attr("href")) chapter.name = urlElement.text() chapter.date_upload = element.select("td:eq(1)").first()?.text()?.let { - SimpleDateFormat("MM/dd/yyyy").parse(it).time + SimpleDateFormat("MM/dd/yyyy", Locale.getDefault()).parse(it).time } ?: 0 return chapter }