parent
852a689669
commit
dcf73cedee
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'Golden Mangás'
|
||||
pkgNameSuffix = 'pt.goldenmangas'
|
||||
extClass = '.GoldenMangas'
|
||||
extVersionCode = 17
|
||||
extVersionCode = 18
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
|
|
@ -8,9 +8,10 @@ import eu.kanade.tachiyomi.source.model.SChapter
|
|||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||
import okhttp3.Headers
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
import java.text.SimpleDateFormat
|
||||
|
@ -24,7 +25,7 @@ class GoldenMangas : ParsedHttpSource() {
|
|||
|
||||
override val name = "Golden Mangás"
|
||||
|
||||
override val baseUrl = "https://goldenmangas.top"
|
||||
override val baseUrl = "https://goldenmanga.top"
|
||||
|
||||
override val lang = "pt-BR"
|
||||
|
||||
|
@ -47,8 +48,8 @@ class GoldenMangas : ParsedHttpSource() {
|
|||
override fun popularMangaSelector(): String = "div#maisLidos div.itemmanga"
|
||||
|
||||
override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply {
|
||||
title = element.select("h3").text().withoutLanguage()
|
||||
thumbnail_url = element.select("img").attr("abs:src")
|
||||
title = element.selectFirst("h3")!!.text().withoutLanguage()
|
||||
thumbnail_url = element.selectFirst("img")!!.absUrl("src")
|
||||
url = element.attr("href")
|
||||
}
|
||||
|
||||
|
@ -62,12 +63,12 @@ class GoldenMangas : ParsedHttpSource() {
|
|||
override fun latestUpdatesSelector() = "div.col-sm-12.atualizacao > div.row"
|
||||
|
||||
override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply {
|
||||
val infoElement = element.select("div.col-sm-10.col-xs-8 h3").first()!!
|
||||
val thumbElement = element.select("a:first-child div img").first()!!
|
||||
val infoElement = element.selectFirst("div.col-sm-10.col-xs-8 h3")!!
|
||||
val thumbElement = element.selectFirst("a:first-child div img")!!
|
||||
|
||||
title = infoElement.text().withoutLanguage()
|
||||
thumbnail_url = thumbElement.attr("abs:src")
|
||||
.replace("w=80&h=120", "w=380&h=600")
|
||||
thumbnail_url = thumbElement.absUrl("src")
|
||||
.replace("w=100&h=140", "w=380&h=600")
|
||||
url = element.select("a:first-child").attr("href")
|
||||
}
|
||||
|
||||
|
@ -78,7 +79,7 @@ class GoldenMangas : ParsedHttpSource() {
|
|||
.set("Referer", "$baseUrl/mangas")
|
||||
.build()
|
||||
|
||||
val url = "$baseUrl/mangas".toHttpUrlOrNull()!!.newBuilder()
|
||||
val url = "$baseUrl/mangas".toHttpUrl().newBuilder()
|
||||
.addQueryParameter("busca", query)
|
||||
.toString()
|
||||
|
||||
|
@ -88,17 +89,28 @@ class GoldenMangas : ParsedHttpSource() {
|
|||
override fun searchMangaSelector() = "div.mangas.col-lg-2 a"
|
||||
|
||||
override fun searchMangaFromElement(element: Element): SManga = SManga.create().apply {
|
||||
title = element.select("h3").text().withoutLanguage()
|
||||
thumbnail_url = element.select("img").attr("abs:src")
|
||||
title = element.selectFirst("h3")!!.text().withoutLanguage()
|
||||
thumbnail_url = element.selectFirst("img")!!.absUrl("src")
|
||||
url = element.attr("href")
|
||||
}
|
||||
|
||||
override fun searchMangaNextPageSelector(): String? = null
|
||||
|
||||
override fun mangaDetailsParse(response: Response): SManga {
|
||||
val mangaResult = runCatching { super.mangaDetailsParse(response) }
|
||||
val manga = mangaResult.getOrNull()
|
||||
|
||||
if (manga?.title.isNullOrEmpty()) {
|
||||
throw Exception(MIGRATE_WARNING)
|
||||
}
|
||||
|
||||
return manga!!
|
||||
}
|
||||
|
||||
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
|
||||
val infoElement = document.select("div.row > div.col-sm-8 > div.row").first()!!
|
||||
val firstColumn = infoElement.select("div.col-sm-4.text-right > img").first()!!
|
||||
val secondColumn = infoElement.select("div.col-sm-8").first()!!
|
||||
val infoElement = document.selectFirst("div.row > div.col-sm-8 > div.row")!!
|
||||
val firstColumn = infoElement.selectFirst("div.col-sm-4.text-right > img")!!
|
||||
val secondColumn = infoElement.selectFirst("div.col-sm-8")!!
|
||||
|
||||
title = secondColumn.select("h2:eq(0)").text().withoutLanguage()
|
||||
author = secondColumn.select("h5:contains(Autor)").text().withoutLabel()
|
||||
|
@ -111,14 +123,24 @@ class GoldenMangas : ParsedHttpSource() {
|
|||
thumbnail_url = firstColumn.attr("abs:src")
|
||||
}
|
||||
|
||||
override fun chapterListParse(response: Response): List<SChapter> {
|
||||
val chaptersResult = runCatching { super.chapterListParse(response) }
|
||||
val chapterList = chaptersResult.getOrNull()
|
||||
|
||||
if (chapterList.isNullOrEmpty()) {
|
||||
throw Exception(MIGRATE_WARNING)
|
||||
}
|
||||
|
||||
return chapterList
|
||||
}
|
||||
|
||||
override fun chapterListSelector() = "ul#capitulos li.row"
|
||||
|
||||
override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply {
|
||||
val firstColumn = element.select("a > div.col-sm-5")
|
||||
val secondColumn = element.select("div.col-sm-5.text-right a[href^='http']")
|
||||
val firstColumn = element.selectFirst("a > div.col-sm-5")!!
|
||||
val secondColumn = element.select("div.col-sm-5.text-right a:not([href^='/'])")
|
||||
|
||||
name = firstColumn.select("div.col-sm-5").first()!!.text()
|
||||
.substringBefore("(").trim()
|
||||
name = firstColumn.text().substringBefore("(").trim()
|
||||
scanlator = secondColumn.joinToString { it.text() }
|
||||
date_upload = firstColumn.select("div.col-sm-5 span[style]").text().toDate()
|
||||
url = element.select("a").attr("href")
|
||||
|
@ -133,11 +155,9 @@ class GoldenMangas : ParsedHttpSource() {
|
|||
}
|
||||
|
||||
override fun pageListParse(document: Document): List<Page> {
|
||||
val chapterImages = document
|
||||
.select("div.col-sm-12[id^='capitulos_images']:has(img[pag])")
|
||||
.firstOrNull()
|
||||
val chapterImages = document.selectFirst("div.col-sm-12[id^='capitulos_images']:has(img[pag])")
|
||||
|
||||
val isNovel = document.select(".block_text_border").firstOrNull() !== null
|
||||
val isNovel = document.selectFirst(".block_text_border") !== null
|
||||
|
||||
if (chapterImages == null && isNovel) {
|
||||
throw Exception(CHAPTER_IS_NOVEL_ERROR)
|
||||
|
@ -187,6 +207,8 @@ class GoldenMangas : ParsedHttpSource() {
|
|||
private const val CHAPTER_IS_NOVEL_ERROR =
|
||||
"O capítulo é uma novel em formato de texto e não possui imagens."
|
||||
|
||||
private const val MIGRATE_WARNING = "Migre o item da Golden Mangás para Golden Mangás para atualizar a URL."
|
||||
|
||||
private val DATE_FORMATTER by lazy {
|
||||
SimpleDateFormat("(dd/MM/yyyy)", Locale.ENGLISH)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue