Manhwa-Latino: Fix missing chapters (#5823)

paginated chapter list
This commit is contained in:
bapeey 2024-11-03 06:41:37 -05:00 committed by GitHub
parent 6577a20ead
commit e1443af7ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 1 deletions

View File

@ -3,7 +3,7 @@ ext {
extClass = '.ManhwaLatino'
themePkg = 'madara'
baseUrl = 'https://manhwa-latino.com'
overrideVersionCode = 7
overrideVersionCode = 8
isNsfw = true
}

View File

@ -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()