FenixManhwas: Fix chapters (#5656)

Fix chapters
This commit is contained in:
Chopper 2024-10-24 08:40:26 -03:00 committed by GitHub
parent d39e0f15f5
commit 97ce648e34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 21 deletions

View File

@ -3,7 +3,7 @@ ext {
extClass = '.FenixManhwas' extClass = '.FenixManhwas'
themePkg = 'zeistmanga' themePkg = 'zeistmanga'
baseUrl = 'https://fenixleitura.blogspot.com' baseUrl = 'https://fenixleitura.blogspot.com'
overrideVersionCode = 0 overrideVersionCode = 1
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -9,9 +9,9 @@ import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.util.asJsoup import eu.kanade.tachiyomi.util.asJsoup
import kotlinx.serialization.decodeFromString import kotlinx.serialization.decodeFromString
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.Request import okhttp3.Request
import okhttp3.Response import okhttp3.Response
import org.jsoup.nodes.Document
class FenixManhwas : ZeistManga( class FenixManhwas : ZeistManga(
"Fênix Manhwas", "Fênix Manhwas",
@ -32,25 +32,12 @@ class FenixManhwas : ZeistManga(
setUrlWithoutDomain(document.location()) setUrlWithoutDomain(document.location())
} }
override fun chapterListRequest(manga: SManga): Request { override fun getChapterFeedUrl(doc: Document): String {
val url = "$baseUrl/feeds/posts/default/-/".toHttpUrl().newBuilder() val feed = doc.selectFirst(".chapter_get")!!.attr("data-labelchapter")
.addPathSegment(manga.title) return apiUrl(chapterCategory)
.addQueryParameter("alt", "json") .addPathSegments(feed)
.addQueryParameter("start-index", "1") .addQueryParameter("max-results", maxChapterResults.toString())
.addQueryParameter("max-results", "99999") .build().toString()
.addQueryParameter("orderby", "updated")
.build()
return GET(url, headers)
}
override fun chapterListParse(response: Response): List<SChapter> {
val result = json.decodeFromString<ZeistMangaDto>(response.body.string())
return result.feed?.entry
?.filter { it.category.orEmpty().any { category -> category.term == chapterCategory } }
?.map { it.toSChapter(baseUrl) }
?.sortedBy { it.name }
?.reversed()
?: throw Exception("Failed to parse from chapter API")
} }
override fun pageListRequest(chapter: SChapter): Request { override fun pageListRequest(chapter: SChapter): Request {