I am trying to parse the html of the following URL:
https://www.smuc.ac.kr/mbs/smuc/jsp/board/list.jsp?boardId=6993&id=smuc_040100000000
I\'m getting the
Following George's comment, I will post this as an answer.
I made a Kotlin version for checklist's solution, as follows:
package crawlers
import java.security.KeyManagementException
import java.security.NoSuchAlgorithmException
import java.security.SecureRandom
import java.security.cert.X509Certificate
import javax.net.ssl.SSLContext
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager
class SSLHelperKotlin {
companion object {
@JvmStatic
fun socketFactory(): SSLSocketFactory {
val trustAllCerts = arrayOf(
object : X509TrustManager {
override fun getAcceptedIssuers() = arrayOf()
override fun checkClientTrusted(certs: Array, authType: String) {}
override fun checkServerTrusted(certs: Array, authType: String) {}
}
)
return try {
val sslContext: SSLContext = SSLContext.getInstance("SSL")
sslContext.init(null, trustAllCerts, SecureRandom())
sslContext.socketFactory
} catch (e: NoSuchAlgorithmException) {
throw RuntimeException("Failed to create a SSL socket factory", e)
} catch (e: KeyManagementException) {
throw RuntimeException("Failed to create a SSL socket factory", e)
}
}
}
}
It's also available on this gist.