Fixed not able to load from hiyobi
This commit is contained in:
@@ -155,9 +155,11 @@ class Cache(context: Context) : ContextWrapper(context) {
|
||||
var retval: Reader? = null
|
||||
|
||||
for (source in sources) {
|
||||
retval = kotlin.runCatching {
|
||||
retval = try {
|
||||
source.value.invoke()
|
||||
}.getOrNull()
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
}
|
||||
|
||||
if (retval != null)
|
||||
break
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package xyz.quaver.hiyobi
|
||||
|
||||
import kotlinx.serialization.UnstableDefault
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.list
|
||||
import org.jsoup.Jsoup
|
||||
@@ -58,14 +59,14 @@ fun renewCookie() : String {
|
||||
}
|
||||
}
|
||||
|
||||
@UseExperimental(UnstableDefault::class)
|
||||
fun getReader(galleryID: Int) : Reader {
|
||||
val reader = "https://$hiyobi/reader/$galleryID"
|
||||
val url = "https://$hiyobi/data/json/${galleryID}_list.json"
|
||||
|
||||
val title = Jsoup.connect(reader).get().title()
|
||||
|
||||
@Suppress("EXPERIMENTAL_API_USAGE")
|
||||
val galleryInfo = Json.parse(
|
||||
val galleryInfo = Json.nonstrict.parse(
|
||||
GalleryInfo.serializer().list,
|
||||
with(URL(url).openConnection() as HttpsURLConnection) {
|
||||
setRequestProperty("User-Agent", user_agent)
|
||||
|
||||
Reference in New Issue
Block a user