xob0t/google_photos_mobile_client

GitHub: xob0t/google_photos_mobile_client

基于逆向 Google Photos 移动端 API 的客户端,支持原画质无限上传与批量管理。

Stars: 230 | Forks: 35

# google_photos_mobile_client 基于逆向工程移动端 API 的 Google Photos 客户端。 ## CLI 演示 ![cli demo](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/6eea564846045214.webp) ## 功能 - 无限上传原图画质(可禁用)。 - 可作为 CLI 工具或 Python 库使用。 - 跳过账户中已存在的文件。 - 上传单个文件或整个目录,支持可选的递归扫描。 - 根据目录结构或自定义名称创建相册。 - 实时进度跟踪。 - 可配置线程以加快上传速度(默认:1)。 ### 如果您更喜欢 GUI 客户端,请使用 [https://github.com/xob0t/gotohp](https://github.com/xob0t/gotohp) ## 安装 运行命令: ``` pip install https://github.com/xob0t/google_photos_mobile_client/archive/refs/heads/main.zip --force-reinstall ``` ## 示例用法 ### Python 客户端 ``` 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"} ``` ### CLI ``` 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] [--proxy PROXY] [--progress] [--recursive] [--threads THREADS] [--force-upload] [--delete-from-host] [--use-quota] [--saver] [--timeout TIMEOUT] [--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [--filter FILTER] [--exclude] [--regex] [--ignore-case] [--match-path] 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 for using 'AUTO': 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) --proxy PROXY Proxy to use. Format: `protocol://username:password@host:port` --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 60. --log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL} Set the logging level (default: INFO) File Filter Options: --filter FILTER Filter expression. --exclude Exclude files matching the filter. --regex Use regex for filtering. --ignore-case Perform case-insensitive matching. --match-path Check for matches in the path, not just the filename. ``` ## auth_data? 在哪里获取? 您只需要执行一次此操作。 ### 选项 1 - ReVanced。无需 root 1. 在您的设备上安装 Google Photos ReVanced。 - 安装 GmsCore [https://github.com/ReVanced/GmsCore/releases](https://github.com/ReVanced/GmsCore/releases) - 安装修补后的 apk [https://github.com/j-hc/revanced-magisk-module/releases](https://github.com/j-hc/revanced-magisk-module/releases) 或自行修补 2. 通过 ADB 将设备连接到 PC。 3. 在 PC 上打开终端并执行 Windows adb logcat | FINDSTR "auth%2Fphotos.native" Linux/Mac adb logcat | grep "auth%2Fphotos.native" 4. 如果您已经在使用 ReVanced - 请从 GmsCore 中移除 Google 账号。 5. 在您的设备上打开 Google Photos ReVanced 并登录您的账号。 6. 终端中应该会出现一条或多条相同的 GmsCore 日志。 7. 从任意日志中复制从 `androidId=` 到行尾的文本。 8. 就这样!🎉 ### 选项 2 - 官方 apk。需要 root
点击展开 1. 准备一台已 root 的 android 设备或模拟器。推荐的 Android 版本为 9-13 2. 通过 ADB 将设备连接到 PC。 3. 安装 [HTTP Toolkit](https://httptoolkit.com) 4. 在 HTTP Toolkit 中,选择 Intercept - `Android Device via ADB`。使用以下规则过滤流量 contains(https://www.googleapis.com/auth/photos.native) 或者如果您使用的是旧版本的 Google Photos,请尝试 contains(www.googleapis.com%2Fauth%2Fplus.photos.readwrite) 5. 打开 Google Photos 应用并使用您的账号登录。 6. 此时应该会出现一个请求。 将请求主体复制为文本。 ![http_toolkit_tip](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/5af004bcef045215.png) 7. 现在您已经获得了您的 auth_data!🎉 #### 故障排除 - __未拦截到 Auth 请求__ 1. 登出您的 Google 账号。 2. 重新登录。 3. 在 HTTP Toolkit 中尝试 `Android App via Frida` 拦截方法。
## 基于 gpmc 的工具 - Docker 化文件夹监控 [Google Photos Uploader](https://github.com/giuseppe99barchetta/Google-Photos-Uploader) 作者 @giuseppe99barchetta ## 我的其它 Google Photos 脚本和工具 - Web api python 客户端:[https://github.com/xob0t/google_photos_web_client](https://github.com/xob0t/google_photos_web_client) - 将任何文件伪装成媒体文件以便 GP 接收并存储:[https://github.com/xob0t/gp-file-hide](https://github.com/xob0t/gp-file-hide) - 通过批量操作管理媒体库:[https://github.com/xob0t/Google-Photos-Toolkit](https://github.com/xob0t/Google-Photos-Toolkit)
标签:API 客户端, Cloud Storage, Google Photos, Python 库, 二进制发布, 云资产清单, 原画质备份, 图片上传, 媒体备份, 媒体管理, 开源工具, 文件上传, 文档结构分析, 无限存储, 本体建模, 爬虫/抓包, 相册管理, 移动端 API, 自动化上传, 逆向工具, 逆向工程