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

Adding support for photos shared library (iOS 16 feature) #395

Open
2 tasks done
simonsickle opened this issue Aug 11, 2022 · 9 comments
Open
2 tasks done

Adding support for photos shared library (iOS 16 feature) #395

simonsickle opened this issue Aug 11, 2022 · 9 comments

Comments

@simonsickle
Copy link

simonsickle commented Aug 11, 2022

The request

I would like to be able to get photos for my shared library, my personal library, or from both. This would allow me to download the images to my server to back them up. Currently, only the personal library can be backed up.

Environment

  • pyiCloud version (pip show pyicloud):
  • Python version (python -V):
  • Operating environment (project deps/Docker/Windows/etc.):

Checklist

  • I've looked informations into the README.
  • I've looked informations into the pyiCloud's code.

Additional information

@xiaobaiya8
Copy link

Upgrade to IOS 16, share pictures with family, and look forward to adding support for shared library

@steilerDev
Copy link

steilerDev commented Oct 28, 2022

As part of my icloud-photos-sync project (that is currently in build up), I already started looking into this.

My findings that I'm happy to share with the project that inspired the above the most:

  • The shared photo library is (as I expected) implemented by providing an additional 'zone' that the user can query against (so as part of queries, we need to change zoneName: 'PrimarySync' to zoneName: "SharedSync-<someUUID>")
  • Discovery of the shared library is done through new endpoints:
    • {{Photos_URL}}/database/1/com.apple.photos.cloud/production/private/changes/database, I'm guessing this returns all libraries owned by the current user
    • {{Photos_URL}}/database/1/com.apple.photos.cloud/production/shared/changes/database, I'm guessing this returns all libraries that the current user is invited to (cannot check this, because I own the library and currently not sharing with anybody)

POST'ing an empty object to those endpoints results in a list of available libraries.

This means supporting shared library should not change most of the interactions besides the setup.

I've created a Postman collection for all iCloud Photos related interactions: https://github.com/steilerDev/icloud-photos-sync/blob/dev/postman/iCloud.postman_collection.json

@pneff
Copy link

pneff commented Oct 31, 2022

I did an initial proof of concept addition implementing shared libraries in this branch: https://github.com/pneff/pyicloud/tree/shared-album-picklepete

Example usage:

    for library_name, album in api.photos.libraries.items():
        print(f'Library: {library_name}')
        for photo in album:
            print(f'{photo.asset_date} {photo} {photo.filename}')

This could easily be extended by adding a shortcut property photos.shared_library. But I am not yet sure if there is only ever one shared library or if there is a circumstance where multiple shared libraries can be present.

@jo-21
Copy link

jo-21 commented Nov 9, 2022

Opened a few pull requests for this:

Hi Patrice, thanks a lot for the PR. I tried it out, but using the SharedSync as Zone-ID, no folders/albums at all popped out. Do you have a clue why? Does the web-API from iCloud still does not support this?

@timrettop
Copy link

Hi @pneff, are you considering revisiting this improvement?

@teh-hippo
Copy link

Please consider this improvement; we've recently shifted all our photos into a shared format. This would be amazing for us.

@lukacat10
Copy link

lukacat10 commented Sep 22, 2023

As part of my icloud-photos-sync project (that is currently in build up), I already started looking into this.

My findings that I'm happy to share with the project that inspired the above the most:

  • The shared photo library is (as I expected) implemented by providing an additional 'zone' that the user can query against (so as part of queries, we need to change zoneName: 'PrimarySync' to zoneName: "SharedSync-<someUUID>")

  • Discovery of the shared library is done through new endpoints:

    • {{Photos_URL}}/database/1/com.apple.photos.cloud/production/private/changes/database, I'm guessing this returns all libraries owned by the current user
    • {{Photos_URL}}/database/1/com.apple.photos.cloud/production/shared/changes/database, I'm guessing this returns all libraries that the current user is invited to (cannot check this, because I own the library and currently not sharing with anybody)

POST'ing an empty object to those endpoints results in a list of available libraries.

This means supporting shared library should not change most of the interactions besides the setup.

I've created a Postman collection for all iCloud Photos related interactions: https://github.com/steilerDev/icloud-photos-sync/blob/dev/postman/iCloud.postman_collection.json

I wanted to see the postman file, but it no longer exists in the branch.

Found it here: https://github.com/steilerDev/icloud-photos-sync/blob/23de04abeabfea93b4d25023d607e7e29be3e7a7/postman/iCloud.postman_collection.json

For future reference :)

@steilerDev
Copy link

steilerDev commented Sep 22, 2023

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

No branches or pull requests

8 participants