From 8d0587c719130651fd8ca5013ed940243c3a62e9 Mon Sep 17 00:00:00 2001 From: Eugene <35057681+e-shl@users.noreply.github.com> Date: Sun, 20 Jun 2021 17:36:05 +0500 Subject: [PATCH] Add page teg [RU] MangaPoisk & MangaBook (#7759) * Add page teg [RU] MangaPoisk & MangaBook * +MangaPoisk LICENSED --- src/ru/mangabook/build.gradle | 2 +- .../extension/ru/mangabook/MangaBook.kt | 11 ++++++++--- src/ru/mangapoisk/build.gradle | 2 +- .../extension/ru/mangapoisk/MangaPoisk.kt | 16 +++++++++------- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/ru/mangabook/build.gradle b/src/ru/mangabook/build.gradle index 483b360d0..733621519 100644 --- a/src/ru/mangabook/build.gradle +++ b/src/ru/mangabook/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'MangaBook' pkgNameSuffix = 'ru.mangabook' extClass = '.MangaBook' - extVersionCode = 4 + extVersionCode = 5 libVersion = '1.2' } diff --git a/src/ru/mangabook/src/eu/kanade/tachiyomi/extension/ru/mangabook/MangaBook.kt b/src/ru/mangabook/src/eu/kanade/tachiyomi/extension/ru/mangabook/MangaBook.kt index 17b543b8a..981ebbebb 100644 --- a/src/ru/mangabook/src/eu/kanade/tachiyomi/extension/ru/mangabook/MangaBook.kt +++ b/src/ru/mangabook/src/eu/kanade/tachiyomi/extension/ru/mangabook/MangaBook.kt @@ -55,14 +55,14 @@ class MangaBook : ParsedHttpSource() { // Search override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { val url = if (query.isNotBlank()) { - "$baseUrl/dosearch?&query=$query" + "$baseUrl/dosearch?query=$query&page=$page" } else { val url = "$baseUrl/filterList?page=$page&ftype[]=0&status[]=0".toHttpUrlOrNull()!!.newBuilder() (if (filters.isEmpty()) getFilterList() else filters).forEach { filter -> when (filter) { is OrderBy -> { val ord = arrayOf("views", "rate", "name", "created_at")[filter.state] - url.addQueryParameter("sortBy", "$ord") + url.addQueryParameter("sortBy", ord) } is CategoryList -> { if (filter.state > 0) { @@ -150,7 +150,12 @@ class MangaBook : ParsedHttpSource() { ratingValue > 0.5 -> "✬☆☆☆☆" else -> "☆☆☆☆☆" } - manga.description = titlestr.last() + "\n" + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + infoElement.select(".fdesc.slice-this").text() + val altSelector = document.select(".vis:contains(Другие названия) span") + var altName = "" + if (altSelector.isNotEmpty()) { + altName = "Альтернативные названия:\n" + altSelector.last().text() + "\n\n" + } + manga.description = titlestr.last() + "\n" + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + altName + infoElement.select(".fdesc.slice-this").text() return manga } diff --git a/src/ru/mangapoisk/build.gradle b/src/ru/mangapoisk/build.gradle index 35d1f3e1f..836cf7335 100644 --- a/src/ru/mangapoisk/build.gradle +++ b/src/ru/mangapoisk/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'MangaPoisk' pkgNameSuffix = 'ru.mangapoisk' extClass = '.MangaPoisk' - extVersionCode = 3 + extVersionCode = 4 libVersion = '1.2' } diff --git a/src/ru/mangapoisk/src/eu/kanade/tachiyomi/extension/ru/mangapoisk/MangaPoisk.kt b/src/ru/mangapoisk/src/eu/kanade/tachiyomi/extension/ru/mangapoisk/MangaPoisk.kt index 3263794b5..1d7fc40f4 100644 --- a/src/ru/mangapoisk/src/eu/kanade/tachiyomi/extension/ru/mangapoisk/MangaPoisk.kt +++ b/src/ru/mangapoisk/src/eu/kanade/tachiyomi/extension/ru/mangapoisk/MangaPoisk.kt @@ -1,7 +1,6 @@ package eu.kanade.tachiyomi.extension.ru.mangapoisk import eu.kanade.tachiyomi.network.GET -import eu.kanade.tachiyomi.network.asObservableSuccess import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage @@ -44,15 +43,15 @@ class MangaPoisk : ParsedHttpSource() { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { val url = if (query.isNotBlank()) { - "$baseUrl/search?q=$query" + "$baseUrl/search?q=$query&page=$page" } else { - val url = "$baseUrl/manga".toHttpUrlOrNull()!!.newBuilder() + val url = "$baseUrl/manga?page=$page".toHttpUrlOrNull()!!.newBuilder() (if (filters.isEmpty()) getFilterList() else filters).forEach { filter -> when (filter) { is OrderBy -> { val ord = arrayOf("-year", "popular", "name", "-published_at", "-last_chapter_at")[filter.state!!.index] val ordRev = arrayOf("year", "-popular", "-name", "published_at", "last_chapter_at")[filter.state!!.index] - url.addQueryParameter("sortBy", if (filter.state!!.ascending) "$ordRev" else "$ord") + url.addQueryParameter("sortBy", if (filter.state!!.ascending) ordRev else ord) } is StatusList -> filter.state.forEach { status -> if (status.state) { @@ -106,7 +105,7 @@ class MangaPoisk : ParsedHttpSource() { override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element) - override fun popularMangaNextPageSelector() = "a.page-link" + override fun popularMangaNextPageSelector() = "a.page-link[rel=next]" override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector() @@ -115,10 +114,13 @@ class MangaPoisk : ParsedHttpSource() { override fun mangaDetailsParse(document: Document): SManga { val infoElement = document.select("article div.card-body").first() val manga = SManga.create() - manga.title = document.select(".post-name").text() + val entitle = infoElement.select(".post-name-en") + manga.title = if (entitle.isNullOrEmpty()) { infoElement.select(".post-name").text() } else entitle.text().replaceRange(0, 2, "") manga.genre = infoElement.select(".post-info > span:eq(10) > a").joinToString { it.text() } manga.description = infoElement.select(".post-info > div .manga-description.entry").text() - manga.status = parseStatus(infoElement.select(".post-info > span:eq(7)").text()) + manga.status = if (document.select(".order-2 h3").text() == "Главы удалены по требованию правообладателя.") { + SManga.LICENSED + } else parseStatus(infoElement.select(".post-info > span:eq(7)").text()) manga.thumbnail_url = infoElement.select("img.img-fluid").first().attr("src") return manga }