From 10a29218b5812ac3f1ebbd5ca6aed3af44ba0596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Mej=C3=ADa?= Date: Fri, 30 Aug 2019 12:02:10 -0600 Subject: [PATCH] Fix TMO #1332 #1437 (#1444) Fix TMO #1332 #1437 --- src/es/tumangaonline/build.gradle | 2 +- .../es/tumangaonline/TuMangaOnline.kt | 58 ++++++++++--------- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/src/es/tumangaonline/build.gradle b/src/es/tumangaonline/build.gradle index 91284ad97..bfe93a0ca 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 = 6 + extVersionCode = 7 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 bcf59277d..ad045bafb 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 @@ -1,16 +1,16 @@ package eu.kanade.tachiyomi.extension.es.tumangaonline +import okhttp3.* +import java.util.* +import org.jsoup.nodes.Element +import org.jsoup.nodes.Document +import java.text.SimpleDateFormat +import java.util.concurrent.TimeUnit import eu.kanade.tachiyomi.network.GET -import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor +import eu.kanade.tachiyomi.util.asJsoup import eu.kanade.tachiyomi.source.model.* import eu.kanade.tachiyomi.source.online.ParsedHttpSource -import eu.kanade.tachiyomi.util.asJsoup -import okhttp3.* -import org.jsoup.nodes.Document -import org.jsoup.nodes.Element -import java.text.SimpleDateFormat -import java.util.* -import java.util.concurrent.TimeUnit +import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor class TuMangaOnline : ParsedHttpSource() { @@ -25,8 +25,7 @@ class TuMangaOnline : ParsedHttpSource() { private val rateLimitInterceptor = RateLimitInterceptor(4) 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) @@ -35,31 +34,32 @@ class TuMangaOnline : ParsedHttpSource() { override fun headersBuilder(): Headers.Builder { return Headers.Builder() .add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) Gecko/20100101 Firefox/60") + .add("Referer", "$baseUrl/") + .add("Cache-mode", "no-cache") } private fun getBuilder(url: String): String { - val req = Request.Builder() - .headers(headersBuilder() - .add("Referer", "$baseUrl/library/manga/") - .add("Cache-mode", "no-cache") - .build()) - .url(url) - .build() + val req = Request.Builder() + .headers(headersBuilder().add("Referer", "$baseUrl/library/manga/").build()) + .url(url) + .build() - return client.newCall(req) - .execute() - .request() - .url() - .toString() - } + return client.newCall(req) + .execute() + .request() + .url() + .toString() + } override fun popularMangaSelector() = "div.element" - override fun latestUpdatesSelector() = popularMangaSelector() + override fun latestUpdatesSelector() = "div.upload-file-row" + //override fun latestUpdatesSelector() = popularMangaSelector() override fun popularMangaRequest(page: Int) = GET("$baseUrl/library?order_item=likes_count&order_dir=desc&type=&filter_by=title&page=$page", headers) - override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/library?order_item=creation&order_dir=desc&type=&filter_by=title&page=$page", headers) + //override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/library?order_item=creation&order_dir=desc&type=&filter_by=title&page=$page", headers) + override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/?page=$page&uploads_mode=thumbnail#latest_uploads", headers) override fun popularMangaFromElement(element: Element) = SManga.create().apply { element.select("div.element > a").let { @@ -69,7 +69,13 @@ class TuMangaOnline : ParsedHttpSource() { } } - override fun latestUpdatesFromElement(element: Element) = popularMangaFromElement(element) + override fun latestUpdatesFromElement(element: Element) = SManga.create().apply { + element.select("div.upload-file-row > a").let { + setUrlWithoutDomain(it.attr("href")) + title = it.select("div.thumbnail-title > h4.text-truncate").text() + thumbnail_url = it.select("div.thumbnail > style").toString().substringAfter("url('").substringBefore("');") + } + } override fun mangaDetailsParse(document: Document) = SManga.create().apply { document.select("h5.card-title").let {