Version 2.3.3

This commit is contained in:
Mikołaj Pich 2024-01-03 15:37:48 +01:00
parent ee396f1650
commit 444caeafa7
2 changed files with 12 additions and 2 deletions

View file

@ -18,7 +18,7 @@ ext {
moshi = "1.13.0" moshi = "1.13.0"
} }
version = "2.3.3-SNAPSHOT" version = "2.3.3"
group = "io.github.wulkanowy" group = "io.github.wulkanowy"
nexusPublishing { nexusPublishing {

View file

@ -59,6 +59,7 @@ internal class ErrorInterceptor(
errorMessage.isNotBlank() -> throw BadCredentialsException(errorMessage) errorMessage.isNotBlank() -> throw BadCredentialsException(errorMessage)
else -> logger.warn("Unexpected login page!") else -> logger.warn("Unexpected login page!")
} }
else -> throw BadCredentialsException(errorMessage) else -> throw BadCredentialsException(errorMessage)
} }
} }
@ -95,15 +96,24 @@ internal class ErrorInterceptor(
when (doc.title()) { when (doc.title()) {
"Błąd" -> throw VulcanException(doc.body().text(), httpCode) "Błąd" -> throw VulcanException(doc.body().text(), httpCode)
"Błąd strony" -> throw VulcanException(doc.select(".errorMessage").text(), httpCode) "Błąd strony" -> throw VulcanException(doc.select(".errorMessage").text(), httpCode)
"Logowanie" -> throw AccountPermissionException(doc.select(".info-error-message-text").first()?.text().orEmpty()) "Logowanie" -> throw AccountPermissionException(
buildString {
val newMessage = doc.select(".info-error-message-text").first()?.text().orEmpty()
val oldMessage = doc.select("div").last()?.ownText().orEmpty().split(" Jeśli")[0]
append(newMessage.ifBlank { oldMessage })
},
)
"Login Service" -> { "Login Service" -> {
cookies.cookieStore.removeAll() // workaround for very strange (random) errors cookies.cookieStore.removeAll() // workaround for very strange (random) errors
throw ScrapperException(doc.select("#MainDiv > div").text(), httpCode) throw ScrapperException(doc.select("#MainDiv > div").text(), httpCode)
} }
"Połączenie zablokowane" -> throw ConnectionBlockedException(doc.body().text()) "Połączenie zablokowane" -> throw ConnectionBlockedException(doc.body().text())
"Just a moment..." -> if (doc.select(".footer").text().contains("Cloudflare")) { "Just a moment..." -> if (doc.select(".footer").text().contains("Cloudflare")) {
throw ConnectionBlockedException(doc.select("#challenge-body-text").text()) throw ConnectionBlockedException(doc.select("#challenge-body-text").text())
} }
"Przerwa" -> throw ServiceUnavailableException(doc.title()) "Przerwa" -> throw ServiceUnavailableException(doc.title())
"Przerwa techniczna" -> throw ServiceUnavailableException(doc.title()) "Przerwa techniczna" -> throw ServiceUnavailableException(doc.title())
"Strona nie została odnaleziona" -> throw ScrapperException(doc.title(), httpCode) "Strona nie została odnaleziona" -> throw ScrapperException(doc.title(), httpCode)