I am downloading html source code of this webpage https://tv.zam.it/ch-Rai-1 using this:
String content= "";
URLConnection connection = null;
try {
URL url = new URL(address[0]);
connection = (URLConnection) url.openConnection();
Scanner scanner = new Scanner(connection.getInputStream());
scanner.useDelimiter("\\Z");
while (scanner.hasNext()) content += scanner.next();
scanner.close();
} catch (Exception ex) {
content = ex.toString();
}
- on 2019 samsung phone with android 9 works fine
- on fire tv stick (Fire OS 5.2.8.0) works fine
- on w95 android tv box (android 7.1.2) it returns this message:
javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
I tried many of the suggested solutions but I could not make any of them change a thing. The webpage just provides tv shows info and I just need to fetch some strings from the sources, no fancy things or strict security checks required. Any suggestion?