From bae97809f5a9f4ae8614b59dbee241bb528e7f42 Mon Sep 17 00:00:00 2001 From: happywillow0 <45346080+happywillow0@users.noreply.github.com> Date: Fri, 18 Oct 2019 07:18:04 -0400 Subject: [PATCH] [Improvement] TuMangaOnline - Removed dups from latest updates (#1668) [Improvement] TuMangaOnline - Removed dups from latest updates --- src/es/tumangaonline/build.gradle | 2 +- .../extension/es/tumangaonline/TuMangaOnline.kt | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/es/tumangaonline/build.gradle b/src/es/tumangaonline/build.gradle index 998c2d917..f6bd0678b 100755 --- a/src/es/tumangaonline/build.gradle +++ b/src/es/tumangaonline/build.gradle @@ -5,7 +5,7 @@ ext { appName = 'Tachiyomi: TuMangaOnline' pkgNameSuffix = 'es.tumangaonline' extClass = '.TuMangaOnline' - extVersionCode = 8 + extVersionCode = 9 libVersion = '1.2' } diff --git a/src/es/tumangaonline/src/eu/kanade/tachiyomi/extension/es/tumangaonline/TuMangaOnline.kt b/src/es/tumangaonline/src/eu/kanade/tachiyomi/extension/es/tumangaonline/TuMangaOnline.kt index 8507b2059..7c36d0558 100755 --- a/src/es/tumangaonline/src/eu/kanade/tachiyomi/extension/es/tumangaonline/TuMangaOnline.kt +++ b/src/es/tumangaonline/src/eu/kanade/tachiyomi/extension/es/tumangaonline/TuMangaOnline.kt @@ -22,10 +22,11 @@ class TuMangaOnline : ParsedHttpSource() { override val supportsLatest = true - private val rateLimitInterceptor = RateLimitInterceptor(4) + private val rateLimitInterceptor = RateLimitInterceptor(2) override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .addNetworkInterceptor(rateLimitInterceptor).connectTimeout(1, TimeUnit.MINUTES) + .addNetworkInterceptor(rateLimitInterceptor) + .connectTimeout(1, TimeUnit.MINUTES) .readTimeout(1, TimeUnit.MINUTES) .retryOnConnectionFailure(true) .followRedirects(true) @@ -68,6 +69,17 @@ class TuMangaOnline : ParsedHttpSource() { thumbnail_url = it.select("style").toString().substringAfter("('").substringBeforeLast("')") } } + + override fun latestUpdatesParse(response: Response): MangasPage { + val document = response.asJsoup() + val mangas = document.select(latestUpdatesSelector()) + .distinctBy { it.select("div.thumbnail-title > h4.text-truncate").text().trim() } + .map { latestUpdatesFromElement(it) } + val hasNextPage = latestUpdatesNextPageSelector().let { selector -> + document.select(selector).first() + } != null + return MangasPage(mangas, hasNextPage) + } override fun latestUpdatesFromElement(element: Element) = SManga.create().apply { element.select("div.upload-file-row > a").let {