Fix no pages found in MW. (#10344)

This commit is contained in:
Alessandro Jean 2022-01-05 08:17:42 -03:00 committed by GitHub
parent d73e504087
commit 6baad09192
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 8 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Mundo Webtoon'
pkgNameSuffix = 'pt.mundowebtoon'
extClass = '.MundoWebtoon'
extVersionCode = 1
extVersionCode = 2
}
dependencies {

View File

@ -2,15 +2,19 @@ package eu.kanade.tachiyomi.extension.pt.mundowebtoon
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import okhttp3.FormBody
import okhttp3.Headers
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import java.text.SimpleDateFormat
@ -86,8 +90,15 @@ class MundoWebtoon : ParsedHttpSource() {
override fun searchMangaNextPageSelector(): String? = null
override fun mangaDetailsParse(response: Response): SManga {
val fixedHtml = response.body!!.string().replace("\t", " ")
val document = Jsoup.parse(fixedHtml, response.request.url.toString())
return mangaDetailsParse(document)
}
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
val infoElement = document.selectFirst("div.andro_product-single-content")
val infoElement = document.select("div.andro_product-single-content").first()!!
title = infoElement.select("div.mangaTitulo h3").text().withoutLanguage()
author = infoElement.select("div.BlDataItem:contains(Autor) a")
@ -114,17 +125,26 @@ class MundoWebtoon : ParsedHttpSource() {
}
override fun pageListRequest(chapter: SChapter): Request {
val newHeaders = headersBuilder()
.set("Referer", baseUrl + chapter.url.substringBeforeLast("/"))
val chapterUrl = (baseUrl + chapter.url).toHttpUrl()
val payload = FormBody.Builder()
.add("data", chapterUrl.pathSegments[1])
.add("num", chapterUrl.pathSegments[2])
.add("modo", "1")
.add("busca", "img")
.build()
return GET(baseUrl + chapter.url, newHeaders)
val newHeaders = headersBuilder()
.add("Content-Length", payload.contentLength().toString())
.add("Content-Type", payload.contentType().toString())
.set("Referer", baseUrl + chapter.url)
.build()
return POST("$baseUrl/leitor_image.php", newHeaders, payload)
}
override fun pageListParse(document: Document): List<Page> {
val chapterImages = document.select("div.container_images_img").first()
return chapterImages.select("img[pag]")
return document.select("img[pag]")
.mapIndexed { i, element ->
Page(i, document.location(), element.attr("abs:src"))
}