MNS: Fix popular and latest tabs again (#1368)

bruh
This commit is contained in:
Rolando Lecca 2024-02-18 22:09:19 -05:00 committed by GitHub
parent f22f245d9a
commit 59a91b7f56
2 changed files with 30 additions and 2 deletions

View File

@ -3,7 +3,7 @@ ext {
extClass = '.MangasNoSekai'
themePkg = 'madara'
baseUrl = 'https://mangasnosekai.com'
overrideVersionCode = 4
overrideVersionCode = 5
}
apply from: "$rootDir/common.gradle"

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.extension.es.mangasnosekai
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.network.interceptor.rateLimitHost
import eu.kanade.tachiyomi.source.model.SChapter
@ -21,16 +22,43 @@ class MangasNoSekai : Madara(
"es",
SimpleDateFormat("MMMM dd, yyyy", Locale("es")),
) {
override val useLoadMoreRequest = LoadMoreStrategy.Never
override val client = super.client.newBuilder()
.rateLimitHost(baseUrl.toHttpUrl(), 2, 1)
.build()
override val useNewChapterEndpoint = true
override val mangaSubString = "manganewo"
private var libraryPath = ""
private fun getLibraryPath() {
libraryPath = try {
val document = client.newCall(GET(baseUrl, headers)).execute().asJsoup()
val libraryUrl = document.selectFirst("li#menu-item-3116.menu-item > a[href]")
libraryUrl?.attr("href")?.removeSuffix("/")?.substringAfterLast("/")
?: "manganewos"
} catch (e: Exception) {
"manganewos"
}
}
override fun popularMangaRequest(page: Int): Request {
if (libraryPath.isBlank()) getLibraryPath()
return GET("$baseUrl/$libraryPath/${searchPage(page)}?m_orderby=views", headers)
}
override fun latestUpdatesRequest(page: Int): Request {
if (libraryPath.isBlank()) getLibraryPath()
return GET("$baseUrl/$libraryPath/${searchPage(page)}?m_orderby=latest", headers)
}
override fun popularMangaSelector() = "div.page-listing-item > div.row > div"
override fun popularMangaNextPageSelector() = "a.next.page-numbers"
override val popularMangaUrlSelector = "a[href]"
override fun popularMangaFromElement(element: Element): SManga {