[RU]Manga/Hentailib name correct in details (#11152)
* [RU]Manga/Hentailib name correct in details * no duplicate
This commit is contained in:
parent
ed56a22115
commit
913d9dca86
|
@ -6,7 +6,7 @@ ext {
|
|||
extName = 'HentaiLib'
|
||||
pkgNameSuffix = 'ru.libhentai'
|
||||
extClass = '.LibHentai'
|
||||
extVersionCode = 9
|
||||
extVersionCode = 10
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
|
|
@ -181,6 +181,13 @@ class LibHentai : ConfigurableSource, HttpSource() {
|
|||
|
||||
override fun mangaDetailsParse(response: Response): SManga {
|
||||
val document = response.asJsoup()
|
||||
val dataStr = document
|
||||
.toString()
|
||||
.substringAfter("window.__DATA__ = ")
|
||||
.substringBefore("window._SITE_COLOR_")
|
||||
.substringBeforeLast(";")
|
||||
|
||||
val dataManga = json.decodeFromString<JsonObject>(dataStr)["manga"]
|
||||
|
||||
val manga = SManga.create()
|
||||
|
||||
|
@ -212,7 +219,11 @@ class LibHentai : ConfigurableSource, HttpSource() {
|
|||
else -> "☆☆☆☆☆"
|
||||
}
|
||||
val genres = document.select(".media-tags > a").map { it.text().capitalize() }
|
||||
manga.title = if (isEng.equals("rus")) document.select(".media-name__main").text() else document.select(".media-name__alt").text()
|
||||
manga.title = when {
|
||||
isEng.equals("rus") && dataManga!!.jsonObject["rusName"]?.jsonPrimitive?.content.orEmpty().isNotEmpty() -> dataManga.jsonObject["rusName"]!!.jsonPrimitive.content
|
||||
isEng.equals("eng") && dataManga!!.jsonObject["engName"]?.jsonPrimitive?.content.orEmpty().isNotEmpty() -> dataManga.jsonObject["engName"]!!.jsonPrimitive.content
|
||||
else -> dataManga!!.jsonObject["name"]!!.jsonPrimitive.content
|
||||
}
|
||||
manga.thumbnail_url = document.select(".media-sidebar__cover > img").attr("src")
|
||||
manga.author = body.select("div.media-info-list__title:contains(Автор) + div").text()
|
||||
manga.artist = body.select("div.media-info-list__title:contains(Художник) + div").text()
|
||||
|
@ -230,13 +241,17 @@ class LibHentai : ConfigurableSource, HttpSource() {
|
|||
else -> SManga.UNKNOWN
|
||||
}
|
||||
manga.genre = category + ", " + rawAgeStop + ", " + genres.joinToString { it.trim() }
|
||||
val altSelector = document.select(".media-info-list__item_alt-names .media-info-list__value div")
|
||||
var altName = ""
|
||||
if (altSelector.isNotEmpty()) {
|
||||
altName = "Альтернативные названия:\n" + altSelector.map { it.text() }.joinToString(" / ") + "\n\n"
|
||||
|
||||
val altName = if (dataManga!!.jsonObject["altNames"]?.jsonArray.orEmpty().isNotEmpty())
|
||||
"Альтернативные названия:\n" + dataManga.jsonObject["altNames"]!!.jsonArray.joinToString(" / ") { it.jsonPrimitive.content } + "\n\n"
|
||||
else ""
|
||||
|
||||
val mediaNameLanguage = when {
|
||||
isEng.equals("eng") && dataManga!!.jsonObject["rusName"]?.jsonPrimitive?.content.orEmpty().isNotEmpty() -> dataManga.jsonObject["rusName"]!!.jsonPrimitive.content + "\n"
|
||||
isEng.equals("rus") && dataManga!!.jsonObject["engName"]?.jsonPrimitive?.content.orEmpty().isNotEmpty() -> dataManga.jsonObject["engName"]!!.jsonPrimitive.content + "\n"
|
||||
else -> ""
|
||||
}
|
||||
val mediaNameLanguage = if (isEng.equals("rus")) document.select(".media-name__alt").text() else document.select(".media-name__main").text()
|
||||
manga.description = mediaNameLanguage + "\n" + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + altName + document.select(".media-description__text").text()
|
||||
manga.description = mediaNameLanguage + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + altName + document.select(".media-description__text").text()
|
||||
return manga
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ ext {
|
|||
extName = 'MangaLib'
|
||||
pkgNameSuffix = 'ru.libmanga'
|
||||
extClass = '.LibManga'
|
||||
extVersionCode = 65
|
||||
extVersionCode = 66
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -174,6 +174,13 @@ class LibManga : ConfigurableSource, HttpSource() {
|
|||
|
||||
override fun mangaDetailsParse(response: Response): SManga {
|
||||
val document = response.asJsoup()
|
||||
val dataStr = document
|
||||
.toString()
|
||||
.substringAfter("window.__DATA__ = ")
|
||||
.substringBefore("window._SITE_COLOR_")
|
||||
.substringBeforeLast(";")
|
||||
|
||||
val dataManga = json.decodeFromString<JsonObject>(dataStr)["manga"]
|
||||
|
||||
val manga = SManga.create()
|
||||
|
||||
|
@ -205,7 +212,11 @@ class LibManga : ConfigurableSource, HttpSource() {
|
|||
else -> "☆☆☆☆☆"
|
||||
}
|
||||
val genres = document.select(".media-tags > a").map { it.text().capitalize() }
|
||||
manga.title = if (isEng.equals("rus")) document.select(".media-name__main").text() else document.select(".media-name__alt").text()
|
||||
manga.title = when {
|
||||
isEng.equals("rus") && dataManga!!.jsonObject["rusName"]?.jsonPrimitive?.content.orEmpty().isNotEmpty() -> dataManga.jsonObject["rusName"]!!.jsonPrimitive.content
|
||||
isEng.equals("eng") && dataManga!!.jsonObject["engName"]?.jsonPrimitive?.content.orEmpty().isNotEmpty() -> dataManga.jsonObject["engName"]!!.jsonPrimitive.content
|
||||
else -> dataManga!!.jsonObject["name"]!!.jsonPrimitive.content
|
||||
}
|
||||
manga.thumbnail_url = document.select(".media-sidebar__cover > img").attr("src")
|
||||
manga.author = body.select("div.media-info-list__title:contains(Автор) + div").text()
|
||||
manga.artist = body.select("div.media-info-list__title:contains(Художник) + div").text()
|
||||
|
@ -223,13 +234,17 @@ class LibManga : ConfigurableSource, HttpSource() {
|
|||
else -> SManga.UNKNOWN
|
||||
}
|
||||
manga.genre = category + ", " + rawAgeStop + ", " + genres.joinToString { it.trim() }
|
||||
val altSelector = document.select(".media-info-list__item_alt-names .media-info-list__value div")
|
||||
var altName = ""
|
||||
if (altSelector.isNotEmpty()) {
|
||||
altName = "Альтернативные названия:\n" + altSelector.map { it.text() }.joinToString(" / ") + "\n\n"
|
||||
|
||||
val altName = if (dataManga!!.jsonObject["altNames"]?.jsonArray.orEmpty().isNotEmpty())
|
||||
"Альтернативные названия:\n" + dataManga.jsonObject["altNames"]!!.jsonArray.joinToString(" / ") { it.jsonPrimitive.content } + "\n\n"
|
||||
else ""
|
||||
|
||||
val mediaNameLanguage = when {
|
||||
isEng.equals("eng") && dataManga!!.jsonObject["rusName"]?.jsonPrimitive?.content.orEmpty().isNotEmpty() -> dataManga.jsonObject["rusName"]!!.jsonPrimitive.content + "\n"
|
||||
isEng.equals("rus") && dataManga!!.jsonObject["engName"]?.jsonPrimitive?.content.orEmpty().isNotEmpty() -> dataManga.jsonObject["engName"]!!.jsonPrimitive.content + "\n"
|
||||
else -> ""
|
||||
}
|
||||
val mediaNameLanguage = if (isEng.equals("rus")) document.select(".media-name__alt").text() else document.select(".media-name__main").text()
|
||||
manga.description = mediaNameLanguage + "\n" + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + altName + document.select(".media-description__text").text()
|
||||
manga.description = mediaNameLanguage + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + altName + document.select(".media-description__text").text()
|
||||
return manga
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue