tmyroadctfig / icloud4j

Other
22 stars 18 forks source link

Handling packages from the DriveNode class≈ #11

Open tibexl opened 4 years ago

tibexl commented 4 years ago

When the stored objet is a package (eg a Capture one package), the result does not contain a data_token object but a package object (package_token), which also contains a URL.

        Map<String, Object> dataTokenMap = (Map<String, Object>) result.get("data_token");

        String contentUrl = (String) dataTokenMap.get("url");

In this case it seems that the package file needs to get downloaded differently.
HttpGet contentRequest = new HttpGet(contentUrl);

        try (InputStream inputStream = iCloudService.getHttpClient().execute(contentRequest).getEntity().getContent())