ManhwasNet: update css selectors (#13034)

* ManhwasNet: update css selectors

* ManhwasNet: fixed status always as completed
This commit is contained in:
w1x8l 2022-08-17 16:16:12 -05:00 committed by GitHub
parent e96fd22d30
commit ea74d2b11c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 34 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Manhwas.net'
pkgNameSuffix = 'es.manhwasnet'
extClass = '.ManhwasNet'
extVersionCode = 2
extVersionCode = 3
isNsfw = true
}

View File

@ -11,7 +11,6 @@ import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
class ManhwasNet : HttpSource() {
@ -22,13 +21,13 @@ class ManhwasNet : HttpSource() {
override fun chapterListParse(response: Response): List<SChapter> {
val document = response.asJsoup()
return document.select(".eplister a").map { chapterEl ->
val chapterUrl = getUrlWithoutDomain(chapterEl.attr("href"))
return document.select(".listing-chapters_wrap .chapter-link a").map { chapterAnchor ->
val chapterUrl = getUrlWithoutDomain(chapterAnchor.attr("href"))
val chapterName = chapterUrl.substringAfterLast("-")
val chapter = SChapter.create()
chapter.url = chapterUrl
chapter.name = chapterName
chapter.chapter_number = chapterName.toFloat()
chapter.name = chapterName
chapter.url = chapterUrl
chapter
}
}
@ -39,8 +38,8 @@ class ManhwasNet : HttpSource() {
override fun latestUpdatesParse(response: Response): MangasPage {
val document = response.asJsoup()
val bixbox = document.selectFirst(".bixbox")
val manhwas = parseManhwas(bixbox)
val content = document.selectFirst(".d-flex[style=\"flex-wrap:wrap;\"]")
val manhwas = parseManhwas(content)
return MangasPage(manhwas, false)
}
@ -50,16 +49,16 @@ class ManhwasNet : HttpSource() {
override fun mangaDetailsParse(response: Response): SManga {
val document = response.asJsoup()
val profileManga = document.selectFirst(".profile-manga")
val manhwa = SManga.create()
manhwa.title = profileManga.selectFirst(".post-title h1").text()
manhwa.thumbnail_url = profileManga.selectFirst(".summary_image img").attr("src")
manhwa.description = profileManga.selectFirst(".description-summary p").text()
manhwa.title = document.selectFirst(".entry-title").text()
manhwa.thumbnail_url = document.selectFirst(".thumb img").attr("src")
manhwa.description = document.selectFirst(".entry-content").text()
val estado = document.select(".imptdt a")[1]
val status = profileManga.selectFirst(".post-status .post-content_item:nth-child(2)").text()
manhwa.status = SManga.ONGOING
if (estado.text() == "Finalizado") manhwa.status = SManga.COMPLETED
if (!status.contains("publishing")) manhwa.status = SManga.COMPLETED
return manhwa
}
@ -73,10 +72,7 @@ class ManhwasNet : HttpSource() {
}
override fun popularMangaParse(response: Response): MangasPage {
val document = response.asJsoup()
val manhwas = parseManhwas(document)
val hasNextPage = document.selectFirst(".wpag-li.page-item [rel=\"next\"]") != null
return MangasPage(manhwas, hasNextPage)
return parseLibraryMangas(response)
}
override fun popularMangaRequest(page: Int): Request {
@ -88,10 +84,7 @@ class ManhwasNet : HttpSource() {
}
override fun searchMangaParse(response: Response): MangasPage {
val document = response.asJsoup()
val manhwas = parseManhwas(document)
val hasNextPage = document.selectFirst(".wpag-li.page-item [rel=\"next\"]") != null
return MangasPage(manhwas, hasNextPage)
return parseLibraryMangas(response)
}
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
@ -103,20 +96,25 @@ class ManhwasNet : HttpSource() {
return GET(url.build().toString())
}
private fun parseManhwas(element: Element): List<SManga> {
return element.select(".bsx").map { bxs ->
val manhwa = SManga.create()
manhwa.url = getUrlWithoutDomain(
transformUrl(bxs.selectFirst("a").attr("href"))
)
manhwa.title = bxs.selectFirst(".tt").text().trim()
manhwa.thumbnail_url = bxs.selectFirst(".ts-post-image").attr("src")
manhwa
}
private fun parseLibraryMangas(response: Response): MangasPage {
val document = response.asJsoup()
val content = document.selectFirst(".d-flex[style=\"flex-wrap:wrap;\"]")
val manhwas = parseManhwas(content)
val hasNextPage = document.selectFirst(".pagination .page-link[rel=\"next\"]") != null
return MangasPage(manhwas, hasNextPage)
}
private fun parseManhwas(document: Document): List<SManga> {
return parseManhwas(document.body())
private fun parseManhwas(element: Element): List<SManga> {
return element.select(".series-card").map { seriesCard ->
val seriesCol = seriesCard.parent()
val manhwa = SManga.create()
manhwa.title = seriesCol.selectFirst(".series-title").text().trim()
manhwa.thumbnail_url = seriesCard.selectFirst(".thumb-img").attr("src")
manhwa.url = getUrlWithoutDomain(
transformUrl(seriesCard.selectFirst("a").attr("href"))
)
manhwa
}
}
private fun transformUrl(url: String): String {