Add page teg [RU] MangaPoisk & MangaBook (#7759)

* Add page teg [RU] MangaPoisk & MangaBook

* +MangaPoisk LICENSED
This commit is contained in:
Eugene 2021-06-20 17:36:05 +05:00 committed by GitHub
parent f07c10737f
commit 8d0587c719
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 12 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'MangaBook' extName = 'MangaBook'
pkgNameSuffix = 'ru.mangabook' pkgNameSuffix = 'ru.mangabook'
extClass = '.MangaBook' extClass = '.MangaBook'
extVersionCode = 4 extVersionCode = 5
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -55,14 +55,14 @@ class MangaBook : ParsedHttpSource() {
// Search // Search
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = if (query.isNotBlank()) { val url = if (query.isNotBlank()) {
"$baseUrl/dosearch?&query=$query" "$baseUrl/dosearch?query=$query&page=$page"
} else { } else {
val url = "$baseUrl/filterList?page=$page&ftype[]=0&status[]=0".toHttpUrlOrNull()!!.newBuilder() val url = "$baseUrl/filterList?page=$page&ftype[]=0&status[]=0".toHttpUrlOrNull()!!.newBuilder()
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter -> (if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
when (filter) { when (filter) {
is OrderBy -> { is OrderBy -> {
val ord = arrayOf("views", "rate", "name", "created_at")[filter.state] val ord = arrayOf("views", "rate", "name", "created_at")[filter.state]
url.addQueryParameter("sortBy", "$ord") url.addQueryParameter("sortBy", ord)
} }
is CategoryList -> { is CategoryList -> {
if (filter.state > 0) { if (filter.state > 0) {
@ -150,7 +150,12 @@ class MangaBook : ParsedHttpSource() {
ratingValue > 0.5 -> "✬☆☆☆☆" ratingValue > 0.5 -> "✬☆☆☆☆"
else -> "☆☆☆☆☆" 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 return manga
} }

View File

@ -5,7 +5,7 @@ ext {
extName = 'MangaPoisk' extName = 'MangaPoisk'
pkgNameSuffix = 'ru.mangapoisk' pkgNameSuffix = 'ru.mangapoisk'
extClass = '.MangaPoisk' extClass = '.MangaPoisk'
extVersionCode = 3 extVersionCode = 4
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -1,7 +1,6 @@
package eu.kanade.tachiyomi.extension.ru.mangapoisk package eu.kanade.tachiyomi.extension.ru.mangapoisk
import eu.kanade.tachiyomi.network.GET 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.Filter
import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.MangasPage
@ -44,15 +43,15 @@ class MangaPoisk : ParsedHttpSource() {
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = if (query.isNotBlank()) { val url = if (query.isNotBlank()) {
"$baseUrl/search?q=$query" "$baseUrl/search?q=$query&page=$page"
} else { } else {
val url = "$baseUrl/manga".toHttpUrlOrNull()!!.newBuilder() val url = "$baseUrl/manga?page=$page".toHttpUrlOrNull()!!.newBuilder()
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter -> (if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
when (filter) { when (filter) {
is OrderBy -> { is OrderBy -> {
val ord = arrayOf("-year", "popular", "name", "-published_at", "-last_chapter_at")[filter.state!!.index] 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] 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 -> is StatusList -> filter.state.forEach { status ->
if (status.state) { if (status.state) {
@ -106,7 +105,7 @@ class MangaPoisk : ParsedHttpSource() {
override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element) 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() override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
@ -115,10 +114,13 @@ class MangaPoisk : ParsedHttpSource() {
override fun mangaDetailsParse(document: Document): SManga { override fun mangaDetailsParse(document: Document): SManga {
val infoElement = document.select("article div.card-body").first() val infoElement = document.select("article div.card-body").first()
val manga = SManga.create() 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.genre = infoElement.select(".post-info > span:eq(10) > a").joinToString { it.text() }
manga.description = infoElement.select(".post-info > div .manga-description.entry").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") manga.thumbnail_url = infoElement.select("img.img-fluid").first().attr("src")
return manga return manga
} }