Update MY selectors. (#6549)

This commit is contained in:
Alessandro Jean 2021-04-15 11:30:19 -03:00 committed by GitHub
parent c40ec25b85
commit 8c27f10cc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 20 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'MangaYabu!' extName = 'MangaYabu!'
pkgNameSuffix = 'pt.mangayabu' pkgNameSuffix = 'pt.mangayabu'
extClass = '.MangaYabu' extClass = '.MangaYabu'
extVersionCode = 6 extVersionCode = 7
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -48,7 +48,7 @@ class MangaYabu : ParsedHttpSource() {
override fun popularMangaRequest(page: Int): Request = GET(baseUrl, headers) override fun popularMangaRequest(page: Int): Request = GET(baseUrl, headers)
override fun popularMangaSelector(): String = "main.home div.features:contains(Populares) div.feature > a" override fun popularMangaSelector(): String = "#main div.row:contains(Populares) div.carousel div.card > a"
override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply {
val thumb = element.select("img").first()!! val thumb = element.select("img").first()!!
@ -67,7 +67,7 @@ class MangaYabu : ParsedHttpSource() {
override fun latestUpdatesRequest(page: Int): Request = GET(baseUrl, headers) override fun latestUpdatesRequest(page: Int): Request = GET(baseUrl, headers)
override fun latestUpdatesSelector() = "main.home div.features:contains(Lançamentos) div.feature div.img-container > a" override fun latestUpdatesSelector() = "#main div.row:contains(Lançamentos) div.card div.card-image > a"
override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply { override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply {
val thumb = element.select("img").first()!! val thumb = element.select("img").first()!!
@ -94,35 +94,37 @@ class MangaYabu : ParsedHttpSource() {
return POST("$baseUrl/wp-admin/admin-ajax.php", newHeaders, form) return POST("$baseUrl/wp-admin/admin-ajax.php", newHeaders, form)
} }
override fun searchMangaSelector() = "ul li.gsuggested a" override fun searchMangaSelector() = "ul.popup-list div.row > div.col.s4 a.search-links"
override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply { override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply {
title = element.select("div.contento span.search-name").first()!!.text().withoutFlags() val thumbnail = element.select("img").first()!!
thumbnail_url = element.select("img.search-thumb")!!.attr("src")
title = thumbnail.attr("alt").withoutFlags()
thumbnail_url = thumbnail.attr("src")
setUrlWithoutDomain(element.attr("href")) setUrlWithoutDomain(element.attr("href"))
} }
override fun searchMangaNextPageSelector(): String? = null override fun searchMangaNextPageSelector(): String? = null
override fun mangaDetailsParse(document: Document): SManga { override fun mangaDetailsParse(document: Document): SManga {
val infoElement = document.select("div.manga-single-list div.manga-info").first()!! val infoElement = document.select("div.manga-column")
val statusStr = infoElement.select("div.manga-status").first()!!.textWithoutLabel()
return SManga.create().apply { return SManga.create().apply {
title = infoElement.select("div.manga-title h1")!!.text() title = document.select("div.manga-info > h1").first()!!.text()
status = when (statusStr) { status = infoElement.select("div.manga-column:contains(Status:)").first()!!
"Em lançamento" -> SManga.ONGOING .textWithoutLabel()
"Completo" -> SManga.COMPLETED .toStatus()
else -> SManga.UNKNOWN genre = infoElement.select("div.manga-column:contains(Gêneros:)").first()!!
} .textWithoutLabel()
genre = infoElement.select("div.manga-genres").first()!!.textWithoutLabel() description = document.select("div.manga-info").first()!!.text()
.replace(" ,", ",") .substringAfter(title)
description = document.select("div.manga-synopsis").first()!!.text() .trim()
thumbnail_url = infoElement.select("div.manga-cover img")!!.attr("src") thumbnail_url = document.select("div.manga-index div.mango-hover img")!!
.attr("src")
} }
} }
override fun chapterListSelector() = "div.manga-single-list div.manga-chapters div.single-chapter" override fun chapterListSelector() = "div.manga-info:contains(Capítulos) div.manga-chapters div.single-chapter"
override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply {
name = element.select("a").first()!!.text() name = element.select("a").first()!!.text()
@ -131,7 +133,7 @@ class MangaYabu : ParsedHttpSource() {
} }
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
return document.select("div.manga-pages img") return document.select("div.image-navigator img.slideit")
.mapIndexed { i, element -> .mapIndexed { i, element ->
Page(i, document.location(), element.attr("abs:src")) Page(i, document.location(), element.attr("abs:src"))
} }
@ -171,6 +173,12 @@ class MangaYabu : ParsedHttpSource() {
} }
} }
private fun String.toStatus() = when (this) {
"Em lançamento" -> SManga.ONGOING
"Completo" -> SManga.COMPLETED
else -> SManga.UNKNOWN
}
private fun String.withoutFlags(): String = replace(FLAG_REGEX, "").trim() private fun String.withoutFlags(): String = replace(FLAG_REGEX, "").trim()
private fun Element.textWithoutLabel(): String = text()!!.substringAfter(":").trim() private fun Element.textWithoutLabel(): String = text()!!.substringAfter(":").trim()