Fix TMO #1332 #1437
This commit is contained in:
Edgar Mejía 2019-08-30 12:02:10 -06:00 committed by Eugene
parent 66bada2368
commit 10a29218b5
2 changed files with 33 additions and 27 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: TuMangaOnline'
pkgNameSuffix = 'es.tumangaonline'
extClass = '.TuMangaOnline'
extVersionCode = 6
extVersionCode = 7
libVersion = '1.2'
}

View File

@ -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 {