Manhwas.net - Update CSS Selectors (#14448)

* Update CSS Selectors

* Update CSS Selectors

* Update CSS Selectors

* Fix last image not loading and update recent section
This commit is contained in:
lleccar 2022-12-04 12:12:40 -05:00 committed by GitHub
parent bccd84020f
commit b44700e53c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 19 deletions

View File

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

View File

@ -21,7 +21,7 @@ class ManhwasNet : HttpSource() {
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val document = response.asJsoup() val document = response.asJsoup()
return document.select(".listing-chapters_wrap .chapter-link a").map { chapterAnchor -> return document.select(".fa-book.d-inline-flex").map { chapterAnchor ->
val chapterUrl = getUrlWithoutDomain(chapterAnchor.attr("href")) val chapterUrl = getUrlWithoutDomain(chapterAnchor.attr("href"))
val chapterName = chapterUrl.substringAfterLast("-") val chapterName = chapterUrl.substringAfterLast("-")
val chapter = SChapter.create() val chapter = SChapter.create()
@ -38,8 +38,9 @@ class ManhwasNet : HttpSource() {
override fun latestUpdatesParse(response: Response): MangasPage { override fun latestUpdatesParse(response: Response): MangasPage {
val document = response.asJsoup() val document = response.asJsoup()
val content = document.selectFirst(".d-flex[style=\"flex-wrap:wrap;\"]") val content18 = document.select(".list-unstyled.row").get(0)
val manhwas = parseManhwas(content) val content15 = document.select(".list-unstyled.row").get(1)
val manhwas = parseManhwas(content18) + parseManhwas(content15)
return MangasPage(manhwas, false) return MangasPage(manhwas, false)
} }
@ -49,16 +50,14 @@ class ManhwasNet : HttpSource() {
override fun mangaDetailsParse(response: Response): SManga { override fun mangaDetailsParse(response: Response): SManga {
val document = response.asJsoup() val document = response.asJsoup()
val profileManga = document.selectFirst(".profile-manga") val profileManga = document.selectFirst(".anime-single")
val manhwa = SManga.create() val manhwa = SManga.create()
manhwa.title = profileManga.selectFirst(".post-title h1").text() manhwa.title = profileManga.selectFirst(".title").text()
manhwa.thumbnail_url = profileManga.selectFirst(".summary_image img").attr("src") manhwa.thumbnail_url = profileManga.selectFirst("img").attr("src")
manhwa.description = profileManga.selectFirst(".description-summary p").text() manhwa.description = profileManga.selectFirst(".sinopsis").text().substringAfter(manhwa.title + " ")
val status = profileManga.select(".anime-type-peli.text-white").text()
val status = profileManga.selectFirst(".post-status .post-content_item:nth-child(2)").text()
manhwa.status = SManga.ONGOING manhwa.status = SManga.ONGOING
if (!status.contains("publishing")) manhwa.status = SManga.COMPLETED if (!status.contains("Publicándose")) manhwa.status = SManga.COMPLETED
return manhwa return manhwa
} }
@ -66,7 +65,10 @@ class ManhwasNet : HttpSource() {
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {
val document = response.asJsoup() val document = response.asJsoup()
return document.select("#chapter_imgs img").mapIndexed { i, img -> return document.select("#chapter_imgs img").mapIndexed { i, img ->
val url = img.attr("src") var url = img.attr("src")
if (url.toString().equals("/discord.jpg")) {
url = "$baseUrl/discord.jpg"
}
Page(i, imageUrl = url) Page(i, imageUrl = url)
} }
} }
@ -98,20 +100,19 @@ class ManhwasNet : HttpSource() {
private fun parseLibraryMangas(response: Response): MangasPage { private fun parseLibraryMangas(response: Response): MangasPage {
val document = response.asJsoup() val document = response.asJsoup()
val content = document.selectFirst(".d-flex[style=\"flex-wrap:wrap;\"]") val content = document.selectFirst(".animes")
val manhwas = parseManhwas(content) val manhwas = parseManhwas(content)
val hasNextPage = document.selectFirst(".pagination .page-link[rel=\"next\"]") != null val hasNextPage = document.selectFirst(".pagination .page-link[rel=\"next\"]") != null
return MangasPage(manhwas, hasNextPage) return MangasPage(manhwas, hasNextPage)
} }
private fun parseManhwas(element: Element): List<SManga> { private fun parseManhwas(element: Element): List<SManga> {
return element.select(".series-card").map { seriesCard -> return element.select(".anime").map { anime ->
val seriesCol = seriesCard.parent()
val manhwa = SManga.create() val manhwa = SManga.create()
manhwa.title = seriesCol.selectFirst(".series-title").text().trim() manhwa.title = anime.selectFirst(".title").text().trim()
manhwa.thumbnail_url = seriesCard.selectFirst(".thumb-img").attr("src") manhwa.thumbnail_url = anime.selectFirst("img").attr("src")
manhwa.url = getUrlWithoutDomain( manhwa.url = getUrlWithoutDomain(
transformUrl(seriesCard.selectFirst("a").attr("href")) transformUrl(anime.select("a").attr("href"))
) )
manhwa manhwa
} }