[RU]YagamiProject exclude the same html (#8001)

* [RU]YagamiProject exclude the same html

* fix empty title
This commit is contained in:
Eugene 2021-07-07 14:53:01 +05:00 committed by GitHub
parent 03850d43a7
commit 979592480c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View File

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

View File

@ -37,7 +37,8 @@ class YagamiProject : ParsedHttpSource() {
return SManga.create().apply {
element.select(".title a").first().let {
setUrlWithoutDomain(it.attr("href"))
title = it.attr("title").split(" / ").sorted().first()
val baseTitle = it.attr("title")
title = if (baseTitle.isNullOrEmpty()) { it.text() } else baseTitle.split(" / ").sorted().first()
}
thumbnail_url = element.select(".cover_mini > img").attr("src").replace("thumb_", "")
}
@ -91,21 +92,21 @@ class YagamiProject : ParsedHttpSource() {
val titlestr = document.select("title").text().substringBefore(" :: Yagami").split(" :: ").sorted()
manga.title = titlestr.first().replace(":: ", "")
manga.thumbnail_url = document.select(".cover img").first().attr("src")
manga.author = infoElement.select("li:contains(Автор)").text().substringAfter("Автор(ы): ").split(" / ").sorted().first()
manga.artist = infoElement.select("li:contains(Художник)").text().substringAfter("Художник(и): ").split(" / ").sorted().first()
manga.status = when (infoElement.select("li:contains(Статус перевода) span").text()) {
manga.author = infoElement.select("li:contains(Автор(ы):)")?.first()?.text()?.substringAfter("Автор(ы): ")?.split(" / ")?.sorted()?.first()
manga.artist = infoElement.select("li:contains(Художник(и):)")?.first()?.text()?.substringAfter("Художник(и): ")?.split(" / ")?.sorted()?.first()
manga.status = when (infoElement.select("li:contains(Статус перевода:) span")?.first()?.text()) {
"онгоинг" -> SManga.ONGOING
"активный" -> SManga.ONGOING
"завершён" -> SManga.COMPLETED
else -> SManga.UNKNOWN
}
manga.genre = infoElement.select("li:contains(Жанры)").text().substringAfter("Жанры: ")
val altSelector = infoElement.select("li:contains(Название)")
manga.genre = infoElement.select("li:contains(Жанры:)")?.first()?.text()?.substringAfter("Жанры: ")
val altSelector = infoElement.select("li:contains(Название:)")
var altName = ""
if (altSelector.isNotEmpty()) {
altName = "Альтернативные названия:\n" + altSelector.toString().replace("<li><b>Название</b>: ", "").replace("<br>", " / ").substringAfter(" / ").substringBefore("</li>") + "\n\n"
altName = "Альтернативные названия:\n" + altSelector.first().toString().replace("<li><b>Название</b>: ", "").replace("<br>", " / ").substringAfter(" / ").substringBefore("</li>") + "\n\n"
}
manga.description = titlestr.last().replace(":: ", "") + "\n" + altName + infoElement.select("li:contains(Описание)").text().substringAfter("Описание: ")
manga.description = titlestr.last().replace(":: ", "") + "\n" + altName + infoElement.select("li:contains(Описание:)")?.first()?.text()?.substringAfter("Описание: ")
return manga
}