Fix error handling when getting original image URL
This commit is contained in:
1 parent
5f1200a9b3
commit
acfc81056b
2 files changed
+7
-1
No files matched your search
@@ -194,7 +194,12 @@ private suspend inline fun <T> HttpStatement.fetchUsingAsByteBuffer(crossinline
|
||||
|
||||
object EhEngine {
|
||||
suspend fun getOriginalImageUrl(url: String, referer: String?) = noRedirectEhRequest(url, referer).executeSafely { response ->
|
||||
response.headers["Location"]?.takeUnless { Url(it).isLogin } ?: throw InsufficientGpException()
|
||||
val location = response.headers["Location"] ?: run {
|
||||
val body = response.bodyAsUtf8Text()
|
||||
rethrowExactly(response, body.left(), InsufficientGpException())
|
||||
}
|
||||
if (Url(location).isLogin) throw InsufficientGpException()
|
||||
location
|
||||
}
|
||||
|
||||
suspend fun getPTokenListFromMpv(gid: Long, token: String) = ehRequest(EhUrl.getGalleryMultiPageViewerUrl(gid, token), EhUrl.referer)
|
||||
|
||||
@@ -594,6 +594,7 @@ class SpiderQueen private constructor(val galleryInfo: GalleryInfo) : CoroutineS
|
||||
previousPToken,
|
||||
)
|
||||
}.getOrElse {
|
||||
if (it is FatalException) throw it
|
||||
forceHtml = true
|
||||
return@repeat
|
||||
}.let {
|
||||
|
||||
Reference in new issue
Block a user