mirror of
https://github.com/keiyoushi/extensions-source.git
synced 2024-11-22 10:22:47 +01:00
parent
6577a20ead
commit
e1443af7ba
@ -3,7 +3,7 @@ ext {
|
||||
extClass = '.ManhwaLatino'
|
||||
themePkg = 'madara'
|
||||
baseUrl = 'https://manhwa-latino.com'
|
||||
overrideVersionCode = 7
|
||||
overrideVersionCode = 8
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,14 @@
|
||||
package eu.kanade.tachiyomi.extension.es.manhwalatino
|
||||
|
||||
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.util.asJsoup
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Response
|
||||
import okhttp3.ResponseBody.Companion.toResponseBody
|
||||
import org.jsoup.nodes.Element
|
||||
import java.text.SimpleDateFormat
|
||||
@ -17,6 +22,7 @@ class ManhwaLatino : Madara(
|
||||
) {
|
||||
|
||||
override val client: OkHttpClient = super.client.newBuilder()
|
||||
.rateLimitHost(baseUrl.toHttpUrl(), 1, 1)
|
||||
.addInterceptor { chain ->
|
||||
val request = chain.request()
|
||||
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 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 {
|
||||
val chapter = SChapter.create()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user