Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Photos don't get deleted, even with --delete-after-download #1027

Open
dojoca opened this issue Dec 27, 2024 · 4 comments
Open

Photos don't get deleted, even with --delete-after-download #1027

dojoca opened this issue Dec 27, 2024 · 4 comments
Labels

Comments

@dojoca
Copy link

dojoca commented Dec 27, 2024

Overview

I've run "sudo icloudpd -u "[email protected]" -p "your-password" -d '/your/download/path' --delete-after-download"
I have previously authenticated.

The output is this:
[sudo] password for server:
2024-12-27 12:19:08 DEBUG Authenticating...
2024-12-27 12:19:11 DEBUG Looking up all photos and videos from album All Photos...
2024-12-27 12:19:12 INFO Downloading 24740 original photos and videos to /your/download/path ...
2024-12-27 12:19:15 DEBUG Downloading /your/download/path/2024/10/20/IMG_0247.HEIC...
2024-12-27 12:19:16 INFO Downloaded /your/download/path/2024/10/20/IMG_0247.HEIC
2024-12-27 12:19:16 DEBUG Deleting IMG_0247.HEIC in iCloud...
2024-12-27 12:19:16 DEBUG POST https://icloud-database-url {"atomic": true, "desiredKeys": ["isDeleted"], "operations": [{"operationType": "update", "record": {"fields": {"isDeleted": {"value": 1}}, "recordChangeTag": "2qj5", "recordName": "record-unique-id", "recordType": "CPLAsset"}}], "zoneID": {"zoneName": "PrimarySync", "ownerRecordName": "owner-unique-id", "zoneType": "REGULAR_CUSTOM_ZONE"}}
2024-12-27 12:19:17 DEBUG {'Server': 'AppleHttpServer', 'Date': 'Fri, 27 Dec 2024 04:19:17 GMT', 'Content-Type': 'application/json; charset=UTF-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'X-Responding-Instance': 'instance-details', 'Set-Cookie': 'X-APPLE-WEBAUTH-TOKEN=...;Secure;HttpOnly', 'Access-Control-Allow-Origin': 'https://www.icloud.com', 'Access-Control-Allow-Credentials': 'true', 'Timing-Allow-Origin': 'https://www.icloud.com', 'X-Apple-CloudKit-Version': '1.0', 'Content-Encoding': 'gzip', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains;', 'x-apple-user-partition': '175', 'via': 'cloud-details', 'X-Apple-Request-UUID': 'request-uuid', 'access-control-expose-headers': 'X-Apple-Request-UUID,X-Responding-Instance,Via', 'X-Apple-Edge-Response-Time': '496'}
2024-12-27 12:19:17 DEBUG {'records': [{'recordName': 'record-unique-id', 'recordType': 'CPLAsset', 'fields': {'isDeleted': {'value': 1, 'type': 'INT64'}}, 'pluginFields': {}, 'recordChangeTag': '2zqp', 'created': {'timestamp': 1733362900758, 'userRecordName': 'user-unique-id', 'deviceID': 'device-id'}, 'modified': {'timestamp': 1735273156947, 'userRecordName': 'user-unique-id', 'deviceID': 'device-id'}, 'deleted': False, 'expirationTime': 1738729156}], 'syncToken': 'sync-token'}
2024-12-27 12:19:17 INFO Deleted IMG_0247.HEIC in iCloud
2024-12-27 12:19:17 DEBUG Downloading /your/download/path/2024/10/20/IMG_0246.HEIC...
0%| | 1/24740 [00:05<34:30:53, 5.02s/it]

I then hit CTRL+C (since the error above showed up) and get this:

Aborted!
Traceback (most recent call last):
File "/usr/local/bin/icloudpd", line 5, in
from icloudpd import main
File "/usr/local/lib/python3.10/dist-packages/icloudpd/main.py", line 5, in
sys.exit(subprocess.call([os.path.join(os.path.dirname(file), "icloudpd"), *sys.argv[1:]]))
File "/usr/lib/python3.10/subprocess.py", line 347, in call
return p.wait(timeout=timeout)
File "/usr/lib/python3.10/subprocess.py", line 1209, in wait
return self._wait(timeout=timeout)
File "/usr/lib/python3.10/subprocess.py", line 1959, in _wait
(pid, sts) = self._try_wait(0)
File "/usr/lib/python3.10/subprocess.py", line 1917, in _try_wait
(pid, sts) = os.waitpid(self.pid, wait_flags)
KeyboardInterrupt

Steps to Reproduce

  1. sudo icloudpd -u "[email protected]" -p "your-password" -d '/your/download/path' --delete-after-download

Expected Behavior

It should download then delete the photos from iCloud.

Actual Behavior

The error above happens, photos don't get downloaded then deleted.

Context

It's a pain in the bum to manually delete photos from iCloud.

Also - just to be clear, I have tried this with iCloud in the normal (syncing) mode and in the "photos will be deleted in 30 days" mode.

No idea why this isn't working?

@dojoca dojoca added the bug label Dec 27, 2024
@AndreyNikiforov
Copy link
Collaborator

What version of icloudpd are you using and where did you obtain it? Debugging requests in your output seems not matching parameters.

@dojoca
Copy link
Author

dojoca commented Dec 27, 2024

Hi Andrey - thanks for the quick reply and seasons greetings :)

This is the --version information:
version:1.25.0, commit sha:96f9451, commit timestamp:Wed Dec 4 01:01:43 2024 AWST

as far as I am aware, I've installed icloudpd from this github.

@dojoca
Copy link
Author

dojoca commented Dec 27, 2024

Just realised - is it possible the debugging request on my output isn't working because I ran it through chatGPT to remove identifying information?

@AndreyNikiforov
Copy link
Collaborator

Just realised - is it possible the debugging request on my output isn't working because I ran it through chatGPT to remove identifying information?

The strange part for me was that your log shows 2024-12-27 12:19:16 DEBUG POST... - that should not be displayed unless extra logging is enabled. I tested latest version and it indeed shows log for deleting request - something to clean up.

I tried to reproduce your issue on my test account and image was successfully deleted in iCloud after downloading - icloudpd behaved as expected on my account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants