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 Draff
parent 0ed4e4147f
commit b7ecf1b801
2 changed files with 30 additions and 2 deletions

View File

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

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.extension.es.mangasnosekai package eu.kanade.tachiyomi.extension.es.mangasnosekai
import eu.kanade.tachiyomi.multisrc.madara.Madara import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.network.interceptor.rateLimitHost import eu.kanade.tachiyomi.network.interceptor.rateLimitHost
import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SChapter
@ -21,16 +22,43 @@ class MangasNoSekai : Madara(
"es", "es",
SimpleDateFormat("MMMM dd, yyyy", Locale("es")), SimpleDateFormat("MMMM dd, yyyy", Locale("es")),
) { ) {
override val useLoadMoreRequest = LoadMoreStrategy.Never
override val client = super.client.newBuilder() override val client = super.client.newBuilder()
.rateLimitHost(baseUrl.toHttpUrl(), 2, 1) .rateLimitHost(baseUrl.toHttpUrl(), 2, 1)
.build() .build()
override val useNewChapterEndpoint = true 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 popularMangaSelector() = "div.page-listing-item > div.row > div"
override fun popularMangaNextPageSelector() = "a.next.page-numbers"
override val popularMangaUrlSelector = "a[href]" override val popularMangaUrlSelector = "a[href]"
override fun popularMangaFromElement(element: Element): SManga { override fun popularMangaFromElement(element: Element): SManga {