mirror of
https://github.com/keiyoushi/extensions-source.git
synced 2024-11-21 18:02:42 +01:00
parent
b24bf3b499
commit
49f942a8cb
@ -3,7 +3,7 @@ ext {
|
||||
extClass = '.AnimeXNovel'
|
||||
themePkg = 'zeistmanga'
|
||||
baseUrl = 'https://www.animexnovel.com'
|
||||
overrideVersionCode = 0
|
||||
overrideVersionCode = 1
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
@ -1,41 +1,87 @@
|
||||
package eu.kanade.tachiyomi.extension.pt.animexnovel
|
||||
|
||||
import eu.kanade.tachiyomi.multisrc.zeistmanga.ZeistManga
|
||||
import eu.kanade.tachiyomi.multisrc.zeistmanga.ZeistMangaDto
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import okhttp3.Response
|
||||
|
||||
class AnimeXNovel : ZeistManga("AnimeXNovel", "https://www.animexnovel.com", "pt-BR") {
|
||||
class AnimeXNovel : ZeistManga(
|
||||
"AnimeXNovel",
|
||||
"https://www.animexnovel.com",
|
||||
"pt-BR",
|
||||
) {
|
||||
|
||||
override val mangaCategory: String = "Manga"
|
||||
// ============================== Popular ===============================
|
||||
|
||||
override val popularMangaSelector = "#PopularPosts2 article"
|
||||
override val popularMangaSelectorTitle = "h3 > a"
|
||||
override val popularMangaSelectorUrl = popularMangaSelectorTitle
|
||||
|
||||
override fun popularMangaParse(response: Response): MangasPage {
|
||||
val document = response.asJsoup()
|
||||
val mangas = document.select("div.PopularPosts div.grid > figure").map { element ->
|
||||
SManga.create().apply {
|
||||
thumbnail_url = element.selectFirst("img")!!.attr("abs:src")
|
||||
title = element.selectFirst("figcaption > a")!!.text()
|
||||
setUrlWithoutDomain(element.selectFirst("figcaption > a")!!.attr("href"))
|
||||
}
|
||||
}.filter { it.title.contains("[Mangá]") }
|
||||
|
||||
return MangasPage(mangas, false)
|
||||
}
|
||||
|
||||
override val mangaDetailsSelectorDescription = "div.bc-fff.s1 > h3:contains(Sinopse) ~ div[style=text-align: justify;]"
|
||||
|
||||
private val chapterListSelector = "div:has(> .list-judul:contains(Lista de Capítulos)) div#latest ul > li, div.tab:has(> label:contains(Lista de Capítulos)) div.tab-content ul > li"
|
||||
|
||||
override fun chapterListParse(response: Response): List<SChapter> {
|
||||
val document = response.asJsoup()
|
||||
val chapters = document.select(chapterListSelector)
|
||||
return chapters.map {
|
||||
SChapter.create().apply {
|
||||
name = it.select("a").text()
|
||||
setUrlWithoutDomain(it.select("a").attr("href"))
|
||||
return super.popularMangaParse(response).let { mangaPage ->
|
||||
mangaPage.mangas.filter { it.title.contains("[Mangá]") }.let {
|
||||
mangaPage.copy(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ============================== Latest ===============================
|
||||
|
||||
override fun latestUpdatesParse(response: Response): MangasPage {
|
||||
return super.latestUpdatesParse(response).let {
|
||||
it.copy(it.mangas.filter { it.title.contains("[Mangá]") })
|
||||
}
|
||||
}
|
||||
|
||||
// ============================== Details ===============================
|
||||
|
||||
override fun mangaDetailsParse(response: Response) = SManga.create().apply {
|
||||
val document = response.asJsoup()
|
||||
title = document.selectFirst("h1")!!.text()
|
||||
thumbnail_url = document.selectFirst(".thumb")?.absUrl("src")
|
||||
description = document.selectFirst("#synopsis")?.text()
|
||||
document.selectFirst("span[data-status]")?.let {
|
||||
status = parseStatus(it.text())
|
||||
}
|
||||
genre = document.select("dl:has(dt:contains(Gênero)) dd a")
|
||||
.joinToString { it.text() }
|
||||
|
||||
setUrlWithoutDomain(document.location())
|
||||
}
|
||||
|
||||
// ============================== Chapters ===============================
|
||||
|
||||
override val chapterCategory = "Capítulo"
|
||||
|
||||
override fun chapterListParse(response: Response): List<SChapter> {
|
||||
val document = response.asJsoup()
|
||||
|
||||
val url = getChapterFeedUrl(document).toHttpUrl().newBuilder()
|
||||
.setQueryParameter("start-index", "1")
|
||||
|
||||
val chapters = mutableListOf<SChapter>()
|
||||
do {
|
||||
val res = client.newCall(GET(url.build(), headers)).execute()
|
||||
|
||||
val page = json.decodeFromString<ZeistMangaDto>(res.body.string()).feed?.entry
|
||||
?.filter { it.category.orEmpty().any { category -> category.term == chapterCategory } }
|
||||
?.map { it.toSChapter(baseUrl) }
|
||||
?: emptyList()
|
||||
|
||||
chapters += page
|
||||
url.setQueryParameter("start-index", "${chapters.size + 1}")
|
||||
} while (page.isNotEmpty())
|
||||
|
||||
return chapters
|
||||
}
|
||||
|
||||
// ============================== Pages ===============================
|
||||
|
||||
override val pageListSelector = "#reader .separator"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user