Kotlin爬虫https安全校验问题
在使用Kotlin进行页面分析和爬取数据时,我们需要用到爬虫。但是如果是https协议,可能需要进行安全校验。
我们以某网站(内容保护,不指明)为例,使用Jsoup库进行爬取。
当我们运行时,会报错:
1234567891011121314151617181920212223242526272829303132333435Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) at sun.securit ...