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