[Grouple] Fixes

master
Koitharu 1 year ago
parent 2550b9cac1
commit 764c65563b
Signed by: Koitharu
GPG Key ID: 676DEE768C17A9D7

@ -6,10 +6,7 @@ import org.koitharu.kotatsu.parsers.config.ConfigKey
import org.koitharu.kotatsu.parsers.exception.AuthRequiredException
import org.koitharu.kotatsu.parsers.model.ContentType
import org.koitharu.kotatsu.parsers.model.MangaParserSource
import org.koitharu.kotatsu.parsers.util.domain
import org.koitharu.kotatsu.parsers.util.parseFailed
import org.koitharu.kotatsu.parsers.util.parseHtml
import org.koitharu.kotatsu.parsers.util.urlEncoded
import org.koitharu.kotatsu.parsers.util.*
@MangaSourceParser("ALLHENTAI", "AllHentai", "ru", type = ContentType.HENTAI)
internal class AllHentaiParser(
@ -25,6 +22,9 @@ internal class AllHentaiParser(
)
override val defaultIsNsfw = true
override val isAuthorized: Boolean
get() = super.isAuthorized || context.cookieJar.getCookies(domain).any { it.name == "remember_me" }
override val authUrl: String
get() {
val targetUri = "https://$domain/".urlEncoded()

@ -525,14 +525,18 @@ internal abstract class GroupleParser(
@Throws(IOException::class)
private fun Response.checkIfAuthRequired(): Response {
if (code == HttpURLConnection.HTTP_NOT_FOUND && !isAuthorized) {
val lastPathSegment = request.url.pathSegments.lastOrNull()
if (lastPathSegment == "login") {
closeQuietly()
throw AuthRequiredException(source)
}
val lastPathSegment = request.url.pathSegments.lastOrNull()
if (lastPathSegment == "login") {
if (code == HttpURLConnection.HTTP_NOT_FOUND) {
if (!isAuthorized) {
closeQuietly()
throw AuthRequiredException(source)
} else {
return newBuilder().code(HttpURLConnection.HTTP_OK).build()
}
}
return this
}

Loading…
Cancel
Save