[RU]MangaBook only Eng name and ratestar (#7721)

* [RU]MangaBook only Eng name and ratestar

* add RusAlt name

* delete number search
This commit is contained in:
Eugene 2021-06-18 14:52:41 +05:00 committed by GitHub
parent 550bb4b5f6
commit 660537f6e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 5 deletions

View File

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

View File

@ -41,7 +41,7 @@ class MangaBook : ParsedHttpSource() {
return SManga.create().apply { return SManga.create().apply {
element.select(".sh-desc a").first().let { element.select(".sh-desc a").first().let {
setUrlWithoutDomain(it.attr("href")) setUrlWithoutDomain(it.attr("href"))
title = it.select("div.sh-title").text().split(" / ").last() title = it.select("div.sh-title").text().split(" / ").sorted().first()
} }
thumbnail_url = element.select(".short-poster.img-box > img").attr("src") thumbnail_url = element.select(".short-poster.img-box > img").attr("src")
} }
@ -93,7 +93,7 @@ class MangaBook : ParsedHttpSource() {
return SManga.create().apply { return SManga.create().apply {
element.select(".flist.row a").first().let { element.select(".flist.row a").first().let {
setUrlWithoutDomain(it.attr("href")) setUrlWithoutDomain(it.attr("href"))
title = it.select("h4").text().split(" / ").last() title = it.select("h4 strong").text().split(" / ").sorted().first()
} }
thumbnail_url = element.select(".sposter img.img-responsive").attr("src") thumbnail_url = element.select(".sposter img.img-responsive").attr("src")
} }
@ -114,7 +114,8 @@ class MangaBook : ParsedHttpSource() {
override fun mangaDetailsParse(document: Document): SManga { override fun mangaDetailsParse(document: Document): SManga {
val infoElement = document.select("article.full .fmid").first() val infoElement = document.select("article.full .fmid").first()
val manga = SManga.create() val manga = SManga.create()
manga.title = document.select(".fheader h1").text().split(" / ").last() val titlestr = document.select(".fheader h1").text().split(" / ").sorted()
manga.title = titlestr.first()
manga.thumbnail_url = infoElement.select("img.img-responsive").first().attr("src") manga.thumbnail_url = infoElement.select("img.img-responsive").first().attr("src")
manga.author = infoElement.select(".vis:contains(Автор) > a").text() manga.author = infoElement.select(".vis:contains(Автор) > a").text()
manga.artist = infoElement.select(".vis:contains(Художник) > a").text() manga.artist = infoElement.select(".vis:contains(Художник) > a").text()
@ -134,7 +135,22 @@ class MangaBook : ParsedHttpSource() {
else -> "Манхва" else -> "Манхва"
} }
manga.genre = infoElement.select(".vis:contains(Категории) > a").map { it.text() }.plusElement(category).joinToString { it.trim() } manga.genre = infoElement.select(".vis:contains(Категории) > a").map { it.text() }.plusElement(category).joinToString { it.trim() }
manga.description = infoElement.select(".fdesc.slice-this").text() val ratingValue = infoElement.select(".rating").text().substringAfter("Рейтинг ").substringBefore("/").toFloat() * 2
val ratingVotes = infoElement.select(".rating").text().substringAfter("голосов: ").substringBefore(" ")
val ratingStar = when {
ratingValue > 9.5 -> "★★★★★"
ratingValue > 8.5 -> "★★★★✬"
ratingValue > 7.5 -> "★★★★☆"
ratingValue > 6.5 -> "★★★✬☆"
ratingValue > 5.5 -> "★★★☆☆"
ratingValue > 4.5 -> "★★✬☆☆"
ratingValue > 3.5 -> "★★☆☆☆"
ratingValue > 2.5 -> "★✬☆☆☆"
ratingValue > 1.5 -> "★☆☆☆☆"
ratingValue > 0.5 -> "✬☆☆☆☆"
else -> "☆☆☆☆☆"
}
manga.description = titlestr.last() + "\n" + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + infoElement.select(".fdesc.slice-this").text()
return manga return manga
} }