Improved error report
Lenient JSON decoding
This commit is contained in:
tom5079
2022-01-21 17:08:49 +09:00
parent 51d5f42e8b
commit b3ca1686e3
11 changed files with 55 additions and 122 deletions

View File

@@ -17,17 +17,7 @@
package xyz.quaver.pupil.hitomi
import kotlinx.serialization.Serializable
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import org.jsoup.Jsoup
import xyz.quaver.pupil.webView
import xyz.quaver.readText
import java.net.URL
import java.net.URLDecoder
import java.nio.ByteBuffer
import java.nio.ByteOrder
import java.util.*
import javax.net.ssl.HttpsURLConnection
@Serializable
data class GalleryBlock(
@@ -38,11 +28,9 @@ data class GalleryBlock(
val artists: List<String>,
val series: List<String>,
val type: String,
val language: String,
val language: String?,
val relatedTags: List<String>
)
suspend fun getGalleryBlock(galleryID: Int) : GalleryBlock {
val result = webView.evaluatePromise("get_gallery_block($galleryID)")
return Json.decodeFromString(result)
}
suspend fun getGalleryBlock(galleryID: Int) : GalleryBlock =
webView.evaluatePromise("get_gallery_block($galleryID)")