A robust Python utility for downloading all your Google Photos albums and media with batch processing capability to efficiently handle large collections.
- Download options for flexibility:
- Download all albums at once
- Download multiple selected albums at once
- Download a single specific album
- Batch processing to handle large collections efficiently
- Resume capability (skips previously downloaded files)
- Maintains a download log to track progress
- Retry mechanism for failed downloads
- Support for multiple Google accounts (token-based authentication)
- Python 3.6+
- Google Cloud Platform account with Google Photos Library API enabled
- OAuth 2.0 credentials
-
Clone this repository or download the script.
-
Install required dependencies:
pip install google-auth-oauthlib google-api-python-client requests
-
Set up Google Cloud Platform:
a. Go to Google Cloud Console
b. Create a new project
c. Enable the "Google Photos Library API"
d. Create OAuth 2.0 credentials:
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth client ID"
- Set Application type to "Desktop application"
- Download the JSON file and save it as
credentials.json
in the same directory as the script
Run the script:
python google_photos_downloader.py
- Enter your Google email address when prompted
- A browser window will open for you to sign in to your Google account and grant permissions
- After successful authentication, a token will be saved locally for future use
The script offers three options:
-
Download all albums:
- Enter 'a' when prompted
- All albums will be downloaded to separate folders inside the output directory
-
Download multiple albums:
- Enter 'm' when prompted
- Enter the numbers of the albums you want to download, separated by commas (e.g., "1,3,5")
- The selected albums will be downloaded to separate folders inside the output directory
-
Download a specific album:
- Enter 's' when prompted
- Select an album from the displayed list by entering its number
- The selected album will be downloaded to a folder inside the output directory
By default, files are downloaded to a ./downloads
directory. You can specify a custom path when prompted.
- Authentication: Uses OAuth 2.0 to securely access your Google Photos account
- Album Discovery: Fetches the list of all available albums
- Album Selection: Provides options to download all albums, multiple specific albums, or a single album
- Media Processing: Downloads media items in batches (default 500 items per batch)
- Download Tracking: Maintains a log of downloaded files to support resuming interrupted downloads
- Error Handling: Implements retries for failed downloads and handles API errors gracefully
The script processes media in batches of 500 items by default. This helps:
- Reduce memory usage for large albums
- Provide progress updates
- Allow interrupting and resuming downloads later
- Prevent timeouts for very large collections
If you encounter issues:
- Ensure
credentials.json
is correctly downloaded from Google Cloud Console - Verify the Google Photos Library API is enabled in your GCP project
- Check that your OAuth 2.0 credentials have the correct scopes
- Look for detailed error information in the console output
- Delete the token file (e.g.,
token_your_email_at_gmail_com.pickle
) to force re-authentication
- Video files might be downloaded in a reduced quality format due to Google Photos API limitations
- Some shared albums might not be accessible depending on permissions
- The script honors Google's API quota limits, which may affect download speed
The credentials.json
file and generated token files contain sensitive information. Keep them secure and do not share them.
Contributions are welcome! Feel free to submit issues or pull requests if you have suggestions for improvements.