Luscious fix some images not loading (#9411)

* Add detection for image urls missing a protocol

* Update LusciousGenerator.kt

* Did the testing on wrong qulity setting before

* missed re-adding in last commit
This commit is contained in:
jopejoe1 2021-10-12 23:34:08 +13:00 committed by GitHub
parent e323909165
commit d8f1369583
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -257,10 +257,14 @@ abstract class Luscious(
nextPage = data["info"]["has_next_page"].asBoolean nextPage = data["info"]["has_next_page"].asBoolean
data["items"].asJsonArray.map { data["items"].asJsonArray.map {
val chapter = SChapter.create() val chapter = SChapter.create()
chapter.url = when (getResolutionPref()) { val url = when (getResolutionPref()) {
"-1" -> it["url_to_original"].asString "-1" -> it["url_to_original"].asString
else -> it["thumbnails"][getResolutionPref()?.toInt()!!]["url"].asString else -> it["thumbnails"][getResolutionPref()?.toInt()!!]["url"].asString
} }
when {
url.startsWith("//") -> chapter.url = "https:$url"
else -> chapter.url = url
}
chapter.chapter_number = it["position"].asInt.toFloat() chapter.chapter_number = it["position"].asInt.toFloat()
chapter.name = chapter.chapter_number.toInt().toString() + " - " + it["title"].asString chapter.name = chapter.chapter_number.toInt().toString() + " - " + it["title"].asString
chapter.date_upload = "${it["created"].asLong}000".toLong() chapter.date_upload = "${it["created"].asLong}000".toLong()
@ -335,8 +339,10 @@ abstract class Luscious(
"-1" -> it["url_to_original"].asString "-1" -> it["url_to_original"].asString
else -> it["thumbnails"][getResolutionPref()?.toInt()!!]["url"].asString else -> it["thumbnails"][getResolutionPref()?.toInt()!!]["url"].asString
} }
when {
pages.add(Page(index, url, url)) url.startsWith("//") -> pages.add(Page(index, "https:$url", "https:$url"))
else -> pages.add(Page(index, url, url))
}
} }
if (nextPage) { if (nextPage) {
val newPage = client.newCall(GET(buildAlbumPicturesPageUrl(id, page))).execute() val newPage = client.newCall(GET(buildAlbumPicturesPageUrl(id, page))).execute()

View File

@ -9,7 +9,7 @@ class LusciousGenerator : ThemeSourceGenerator {
override val themeClass = "Luscious" override val themeClass = "Luscious"
override val baseVersionCode: Int = 12 override val baseVersionCode: Int = 13
override val sources = listOf( override val sources = listOf(
MultiLang("Luscious", "https://www.luscious.net", listOf("en", "ja", "es", "it", "de", "fr", "zh", "ko", "other", "pt-BR", "th", "all"), isNsfw = true, className = "LusciousFactory", overrideVersionCode = 2), MultiLang("Luscious", "https://www.luscious.net", listOf("en", "ja", "es", "it", "de", "fr", "zh", "ko", "other", "pt-BR", "th", "all"), isNsfw = true, className = "LusciousFactory", overrideVersionCode = 2),