[RU] Mangachan - Return "Latest" (#12098)

This commit is contained in:
Maxim Molochkov 2022-06-07 03:46:19 +04:00 committed by GitHub
parent 68f61ca058
commit ee8efb1c4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 6 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Mangachan' extName = 'Mangachan'
pkgNameSuffix = 'ru.mangachan' pkgNameSuffix = 'ru.mangachan'
extClass = '.Mangachan' extClass = '.Mangachan'
extVersionCode = 13 extVersionCode = 14
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -28,7 +28,7 @@ class Mangachan : ParsedHttpSource() {
override val lang = "ru" override val lang = "ru"
override val supportsLatest = false override val supportsLatest = true
override val client: OkHttpClient = network.client.newBuilder() override val client: OkHttpClient = network.client.newBuilder()
.rateLimit(2) .rateLimit(2)
@ -66,6 +66,7 @@ class Mangachan : ParsedHttpSource() {
} }
} }
is Status -> status = arrayOf("", "all_done", "end", "ongoing", "new_ch")[filter.state] is Status -> status = arrayOf("", "all_done", "end", "ongoing", "new_ch")[filter.state]
else -> continue
} }
} }
@ -79,6 +80,7 @@ class Mangachan : ParsedHttpSource() {
arrayOf("&n=dateasc", "&n=favdesc", "&n=abcasc", "&n=chdesc")[filter.state!!.index] arrayOf("&n=dateasc", "&n=favdesc", "&n=abcasc", "&n=chdesc")[filter.state!!.index]
} }
} }
else -> continue
} }
} }
if (statusParam) { if (statusParam) {
@ -96,6 +98,7 @@ class Mangachan : ParsedHttpSource() {
arrayOf("manga/new&n=dateasc", "mostfavorites", "catalog", "sortch")[filter.state!!.index] arrayOf("manga/new&n=dateasc", "mostfavorites", "catalog", "sortch")[filter.state!!.index]
} }
} }
else -> continue
} }
} }
if (statusParam) { if (statusParam) {
@ -108,13 +111,12 @@ class Mangachan : ParsedHttpSource() {
return GET(url, headers) return GET(url, headers)
} }
override fun latestUpdatesRequest(page: Int): Request = throw UnsupportedOperationException("Not used") override fun latestUpdatesRequest(page: Int): Request = GET("$baseUrl/manga/new?offset=${20 * (page - 1)}")
override fun latestUpdatesSelector() = throw UnsupportedOperationException("Not used")
override fun latestUpdatesFromElement(element: Element) = throw UnsupportedOperationException("Not used")
override fun latestUpdatesNextPageSelector() = throw UnsupportedOperationException("Not used")
override fun popularMangaSelector() = "div.content_row" override fun popularMangaSelector() = "div.content_row"
override fun latestUpdatesSelector() = popularMangaSelector()
override fun searchMangaSelector() = popularMangaSelector() override fun searchMangaSelector() = popularMangaSelector()
override fun popularMangaFromElement(element: Element): SManga { override fun popularMangaFromElement(element: Element): SManga {
@ -127,8 +129,19 @@ class Mangachan : ParsedHttpSource() {
return manga return manga
} }
override fun latestUpdatesFromElement(element: Element): SManga {
val manga = SManga.create()
manga.title = element.attr("title")
element.select("a:nth-child(1)").first().let {
manga.setUrlWithoutDomain(it.attr("href"))
}
return manga
}
override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element) override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element)
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
override fun popularMangaNextPageSelector() = "a:contains(Вперед)" override fun popularMangaNextPageSelector() = "a:contains(Вперед)"
override fun searchMangaNextPageSelector() = "a:contains(Далее)" override fun searchMangaNextPageSelector() = "a:contains(Далее)"