Cubari: fix long genre/tag issue (#13929)

Closes #13905
This commit is contained in:
Riztard Lanthorn 2022-10-20 21:36:00 +07:00 committed by GitHub
parent 3bf40039e4
commit d0f26eff13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Cubari'
pkgNameSuffix = "all.cubari"
extClass = '.CubariFactory'
extVersionCode = 14
extVersionCode = 15
}
apply from: "$rootDir/common.gradle"

View File

@ -349,8 +349,11 @@ open class Cubari(override val lang: String) : HttpSource() {
title = jsonObj["title"]!!.jsonPrimitive.content
artist = jsonObj["artist"]?.jsonPrimitive?.content ?: ARTIST_FALLBACK
author = jsonObj["author"]?.jsonPrimitive?.content ?: AUTHOR_FALLBACK
description = jsonObj["description"]?.jsonPrimitive?.content?.substringBefore("Tags: ") ?: DESCRIPTION_FALLBACK
genre = jsonObj["description"]?.jsonPrimitive?.content?.substringAfter("Tags: ")
val descriptionFull = jsonObj["description"]?.jsonPrimitive?.content
description = descriptionFull?.substringBefore("Tags: ") ?: DESCRIPTION_FALLBACK
genre = if (descriptionFull!!.contains("Tags: ")) descriptionFull?.substringAfter("Tags: ") else ""
url = mangaReference?.url ?: jsonObj["url"]!!.jsonPrimitive.content
thumbnail_url = jsonObj["coverUrl"]?.jsonPrimitive?.content
?: jsonObj["cover"]?.jsonPrimitive?.content ?: ""