Google Photos client based on reverse engineered mobile API.
- Unlimited uploads in original quality (can be disabled).
- Use as a CLI tool or Python library.
- Skips files already present in your account.
- Upload individual files or entire directories, with optional recursive scanning.
- Album creation based on directory structure or custom album name.
- Real-time progress tracking.
- Configurable threads for faster uploads (default: 1).
Run the command:
pip install https://github.com/xob0t/google_photos_mobile_client/archive/refs/heads/main.zip --force-reinstall
Note
If auth_data is omitted, GP_AUTH_DATA
env variable will be used
from gpmc import Client
path = "/path/to/media_file.jpg" # file or dir path
auth_data = "androidId=216e583113f43c75&app=com.google.android.app..."
client = Client(auth_data=auth_data)
output = client.upload(target=path, show_progress=True)
print(output)
# {"/absolute/path/to/media_file.jpg": "google_photos_media_key"}
gpmc "/path/to/media_file.jpg" --progress --auth_data "androidId=216e583113f43c75&app=com.google.android.app..."
usage: gpmc [-h] [--auth_data AUTH_DATA] [--album ALBUM] [--progress] [--recursive] [--threads THREADS] [--force-upload] [--delete-from-host] [--use-quota] [--saver] [--timeout TIMEOUT] [--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}] path
Google Photos mobile client.
positional arguments:
path Path to the file or directory to upload.
options:
-h, --help show this help message and exit
--auth_data AUTH_DATA
Google auth data for authentication. If not provided, `GP_AUTH_DATA` env variable will be used.
--album ALBUM Add uploaded media to an album with given name. If set to 'AUTO', albums will be created based on the immediate parent directory of each file.
Example:
When uploading '/foo':
'/foo/image1.jpg' goes to 'foo'
'/foo/bar/image2.jpg' goes to 'bar'
'/foo/bar/foo/image3.jpg' goes to 'foo' (distinct from the first 'foo' album)
--progress Display upload progress.
--recursive Scan the directory recursively.
--threads THREADS Number of threads to run uploads with. Defaults to 1.
--force-upload Upload files regardless of their presence in Google Photos (determined by hash).
--delete-from-host Delete uploaded files from source path.
--use-quota Uploaded files will count against your Google Photos storage quota.
--saver Upload files in storage saver quality.
--timeout TIMEOUT Requests timeout, seconds. Defaults to 30.
--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
Set the logging level (default: INFO)
Below is a step by step instruction on how to accuire your Google account's mobile auth data in a simplest way possible.
You only need to do it once.
-
Get a rooted android device or an emulator. Recommended Android version >=9
-
Connect the device to your PC via ADB.
-
Install HTTP Toolkit
-
In HTTP Toolkit, select Intercept -
Android Device via ADB
. Filter traffic withcontains(https://www.googleapis.com/auth/photos.native)
-
Open Google Photos app and login with your account.
-
There should be a single request found.
Copy request body as text.
-
Now you've got yourself your auth_data! 🎉
-
No Auth Request Intercepted
- Log out of your Goolge account.
- Log in again.
- Try
Android App via Frida
interception method in HTTP Toolkit.
-
403 Response Status
- Try intercepting Google Photos ReVanced. Patch it yourself or use a patched apk https://github.com/j-hc/revanced-magisk-module/releases
It uses an alternative to google services, and the format of the auth request is a bit different.
- Try intercepting Google Photos ReVanced. Patch it yourself or use a patched apk https://github.com/j-hc/revanced-magisk-module/releases
- Disguse any file as media for GP to accept and store it: https://github.com/xob0t/gp-file-hide
- Manage library with bulk operations: https://github.com/xob0t/Google-Photos-Toolkit