parent
684a9a0972
commit
404c86ac09
|
@ -3,7 +3,7 @@ ext {
|
||||||
extClass = '.ManhwaLatino'
|
extClass = '.ManhwaLatino'
|
||||||
themePkg = 'madara'
|
themePkg = 'madara'
|
||||||
baseUrl = 'https://manhwa-latino.com'
|
baseUrl = 'https://manhwa-latino.com'
|
||||||
overrideVersionCode = 7
|
overrideVersionCode = 8
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
package eu.kanade.tachiyomi.extension.es.manhwalatino
|
package eu.kanade.tachiyomi.extension.es.manhwalatino
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.multisrc.madara.Madara
|
import eu.kanade.tachiyomi.multisrc.madara.Madara
|
||||||
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import eu.kanade.tachiyomi.network.interceptor.rateLimitHost
|
||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Response
|
||||||
import okhttp3.ResponseBody.Companion.toResponseBody
|
import okhttp3.ResponseBody.Companion.toResponseBody
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
|
@ -17,6 +22,7 @@ class ManhwaLatino : Madara(
|
||||||
) {
|
) {
|
||||||
|
|
||||||
override val client: OkHttpClient = super.client.newBuilder()
|
override val client: OkHttpClient = super.client.newBuilder()
|
||||||
|
.rateLimitHost(baseUrl.toHttpUrl(), 1, 1)
|
||||||
.addInterceptor { chain ->
|
.addInterceptor { chain ->
|
||||||
val request = chain.request()
|
val request = chain.request()
|
||||||
val headers = request.headers.newBuilder()
|
val headers = request.headers.newBuilder()
|
||||||
|
@ -43,6 +49,30 @@ class ManhwaLatino : Madara(
|
||||||
override val mangaDetailsSelectorDescription = "div.post-content_item:contains(Resumen) div.summary-container"
|
override val mangaDetailsSelectorDescription = "div.post-content_item:contains(Resumen) div.summary-container"
|
||||||
override val pageListParseSelector = "div.page-break img.wp-manga-chapter-img"
|
override val pageListParseSelector = "div.page-break img.wp-manga-chapter-img"
|
||||||
|
|
||||||
|
private val chapterListNextPageSelector = "div.pagination > span.current + span"
|
||||||
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
|
val mangaUrl = response.request.url
|
||||||
|
var document = response.asJsoup()
|
||||||
|
launchIO { countViews(document) }
|
||||||
|
|
||||||
|
val chapterList = mutableListOf<SChapter>()
|
||||||
|
var page = 1
|
||||||
|
|
||||||
|
do {
|
||||||
|
val chapterElements = document.select(chapterListSelector())
|
||||||
|
if (chapterElements.isEmpty()) break
|
||||||
|
chapterList.addAll(chapterElements.map { chapterFromElement(it) })
|
||||||
|
val hasNextPage = document.select(chapterListNextPageSelector).isNotEmpty()
|
||||||
|
if (hasNextPage) {
|
||||||
|
page++
|
||||||
|
val nextPageUrl = mangaUrl.newBuilder().setQueryParameter("t", page.toString()).build()
|
||||||
|
document = client.newCall(GET(nextPageUrl, headers)).execute().asJsoup()
|
||||||
|
} else { break }
|
||||||
|
} while (true)
|
||||||
|
|
||||||
|
return chapterList
|
||||||
|
}
|
||||||
|
|
||||||
override fun chapterFromElement(element: Element): SChapter {
|
override fun chapterFromElement(element: Element): SChapter {
|
||||||
val chapter = SChapter.create()
|
val chapter = SChapter.create()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue