[RU] Henchan - Update url and return "Latest" (#11905)

This commit is contained in:
Maxim Molochkov 2022-05-21 01:22:18 +04:00 committed by GitHub
parent 5716819a8d
commit cacee499cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 8 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Henchan' extName = 'Henchan'
pkgNameSuffix = 'ru.henchan' pkgNameSuffix = 'ru.henchan'
extClass = '.Henchan' extClass = '.Henchan'
extVersionCode = 33 extVersionCode = 34
isNsfw = true isNsfw = true
} }

View File

@ -27,11 +27,11 @@ class Henchan : ParsedHttpSource() {
override val name = "Henchan" override val name = "Henchan"
override val baseUrl = "https://xxx.hentaichan.live" override val baseUrl = "https://xxxx.hentaichan.live"
override val lang = "ru" override val lang = "ru"
override val supportsLatest = false override val supportsLatest = true
private val rateLimitInterceptor = RateLimitInterceptor(2) private val rateLimitInterceptor = RateLimitInterceptor(2)
@ -41,6 +41,9 @@ class Henchan : ParsedHttpSource() {
override fun popularMangaRequest(page: Int): Request = override fun popularMangaRequest(page: Int): Request =
GET("$baseUrl/mostfavorites&sort=manga?offset=${20 * (page - 1)}", headers) GET("$baseUrl/mostfavorites&sort=manga?offset=${20 * (page - 1)}", headers)
override fun latestUpdatesRequest(page: Int): Request =
GET("$baseUrl/manga/new?offset=${20 * (page - 1)}", headers)
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = if (query.isNotEmpty()) { val url = if (query.isNotEmpty()) {
@ -57,6 +60,7 @@ class Henchan : ParsedHttpSource() {
genres += (if (f.isExcluded()) "-" else "") + f.id + '+' genres += (if (f.isExcluded()) "-" else "") + f.id + '+'
} }
} }
else -> return@forEach
} }
} }
@ -66,6 +70,7 @@ class Henchan : ParsedHttpSource() {
is OrderBy -> { is OrderBy -> {
order = filter.toUriPartWithGenres() order = filter.toUriPartWithGenres()
} }
else -> return@forEach
} }
} }
"$baseUrl/tags/${genres.dropLast(1)}&sort=manga$order?offset=${20 * (page - 1)}" "$baseUrl/tags/${genres.dropLast(1)}&sort=manga$order?offset=${20 * (page - 1)}"
@ -75,6 +80,7 @@ class Henchan : ParsedHttpSource() {
is OrderBy -> { is OrderBy -> {
order = filter.toUriPartWithoutGenres() order = filter.toUriPartWithoutGenres()
} }
else -> return@forEach
} }
} }
"$baseUrl/$order?offset=${20 * (page - 1)}" "$baseUrl/$order?offset=${20 * (page - 1)}"
@ -85,14 +91,11 @@ class Henchan : ParsedHttpSource() {
override fun popularMangaSelector() = "div.content_row" override fun popularMangaSelector() = "div.content_row"
override fun latestUpdatesRequest(page: Int): Request = throw UnsupportedOperationException("Not used") override fun latestUpdatesSelector() = popularMangaSelector()
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 searchMangaSelector() = ".content_row:not(:has(div.item:containsOwn(Тип)))" override fun searchMangaSelector() = ".content_row:not(:has(div.item:containsOwn(Тип)))"
private fun String.getHQThumbnail(): String? { private fun String.getHQThumbnail(): String {
val isExHenManga = this.contains("/manganew_thumbs_blur/") val isExHenManga = this.contains("/manganew_thumbs_blur/")
val regex = "(?<=/)manganew_thumbs\\w*?(?=/)".toRegex(RegexOption.IGNORE_CASE) val regex = "(?<=/)manganew_thumbs\\w*?(?=/)".toRegex(RegexOption.IGNORE_CASE)
return this.replace(regex, "showfull_retina/manga") return this.replace(regex, "showfull_retina/manga")
@ -110,11 +113,16 @@ class Henchan : ParsedHttpSource() {
return manga return manga
} }
override fun latestUpdatesFromElement(element: Element): SManga =
popularMangaFromElement(element)
override fun searchMangaFromElement(element: Element): SManga = override fun searchMangaFromElement(element: Element): SManga =
popularMangaFromElement(element) popularMangaFromElement(element)
override fun popularMangaNextPageSelector() = "#pagination > a:contains(Вперед)" override fun popularMangaNextPageSelector() = "#pagination > a:contains(Вперед)"
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
override fun searchMangaNextPageSelector() = "#nextlink, ${popularMangaNextPageSelector()}" override fun searchMangaNextPageSelector() = "#nextlink, ${popularMangaNextPageSelector()}"
override fun mangaDetailsParse(document: Document): SManga { override fun mangaDetailsParse(document: Document): SManga {