ReadComicOnline - latest updates fix (#2149)

This commit is contained in:
Mike 2020-01-29 07:35:26 -05:00 committed by GitHub
parent a052fdcfd8
commit 72b25fbd4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 12 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: ReadComicOnline' appName = 'Tachiyomi: ReadComicOnline'
pkgNameSuffix = 'en.readcomiconline' pkgNameSuffix = 'en.readcomiconline'
extClass = '.Readcomiconline' extClass = '.Readcomiconline'
extVersionCode = 6 extVersionCode = 7
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -4,7 +4,6 @@ import android.app.Application
import android.content.SharedPreferences import android.content.SharedPreferences
import android.support.v7.preference.ListPreference import android.support.v7.preference.ListPreference
import android.support.v7.preference.PreferenceScreen import android.support.v7.preference.PreferenceScreen
import android.util.Log
import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.ConfigurableSource
@ -19,6 +18,7 @@ import org.jsoup.nodes.Element
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale
import java.util.regex.Pattern import java.util.regex.Pattern
class Readcomiconline : ConfigurableSource, ParsedHttpSource() { class Readcomiconline : ConfigurableSource, ParsedHttpSource() {
@ -37,9 +37,9 @@ class Readcomiconline : ConfigurableSource, ParsedHttpSource() {
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000) Injekt.get<Application>().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 { override fun popularMangaRequest(page: Int): Request {
return GET("$baseUrl/ComicList/MostPopular?page=$page", headers) return GET("$baseUrl/ComicList/MostPopular?page=$page", headers)
@ -50,12 +50,10 @@ class Readcomiconline : ConfigurableSource, ParsedHttpSource() {
} }
override fun popularMangaFromElement(element: Element): SManga { override fun popularMangaFromElement(element: Element): SManga {
val manga = SManga.create() return SManga.create().apply {
element.select("td a:eq(0)").first().let { setUrlWithoutDomain(element.attr("href"))
manga.setUrlWithoutDomain(it.attr("href")) title = element.text()
manga.title = it.text()
} }
return manga
} }
override fun latestUpdatesFromElement(element: Element): SManga { override fun latestUpdatesFromElement(element: Element): SManga {
@ -87,7 +85,7 @@ class Readcomiconline : ConfigurableSource, ParsedHttpSource() {
return popularMangaFromElement(element) return popularMangaFromElement(element)
} }
override fun searchMangaNextPageSelector() = null override fun searchMangaNextPageSelector(): String? = null
override fun mangaDetailsParse(document: Document): SManga { override fun mangaDetailsParse(document: Document): SManga {
val infoElement = document.select("div.barContent").first() val infoElement = document.select("div.barContent").first()
@ -102,7 +100,7 @@ class Readcomiconline : ConfigurableSource, ParsedHttpSource() {
return manga return manga
} }
fun parseStatus(status: String) = when { private fun parseStatus(status: String) = when {
status.contains("Ongoing") -> SManga.ONGOING status.contains("Ongoing") -> SManga.ONGOING
status.contains("Completed") -> SManga.COMPLETED status.contains("Completed") -> SManga.COMPLETED
else -> SManga.UNKNOWN else -> SManga.UNKNOWN
@ -117,7 +115,7 @@ class Readcomiconline : ConfigurableSource, ParsedHttpSource() {
chapter.setUrlWithoutDomain(urlElement.attr("href")) chapter.setUrlWithoutDomain(urlElement.attr("href"))
chapter.name = urlElement.text() chapter.name = urlElement.text()
chapter.date_upload = element.select("td:eq(1)").first()?.text()?.let { 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 } ?: 0
return chapter return chapter
} }