最近女友送我一台 iPhone,所以就有了如此逆向的操作,估计也就只有中国大陆的玩机用户需要这样吧。
Google photo to iCloud 美区可以直接使用 Google Takeout 一键转移
下载所有 Google Photo 的照片
- Follow Google Photos Takeout Helper README,去新建一个导出任务
- 等待导出成功的邮件,并点开一个,我们来获取用脚本批量下载的基本数据
- 文件列表
- 右键复制一个下载链接
https://takeout.google.com/takeout/download?j=1162e805-3b09-494c-ba99-6bb0bb7719b9&i=0&user=105433832262546547905
- 浏览器装一个可以导出下载任务为命令行工具的插件,比如我这里用 cliget
- 得到命令:
aria2c --header 'Host: takeout-download.usercontent.google.com' --user-agent ... 'https://takeout-download.usercontent.google.com/download/takeout-20250303T133330Z-001.zip?j=1162e805-3b09-494c-ba99-6bb0bb7719b9&i=0&user=779537051113&authuser=0' --out 'takeout-20250303T133330Z-001.zip'
- 现在我们可以发现具体下载第几个文件是 URL 里的 “&i=0&user=” 的 i 控制的,第一个文件就是 i=0
- 文件列表
- 编写一个批量下载脚本
#!/usr/bin/env python3
import subprocess
from pathlib import Path
command_template = r"aria2c --header 'Host: takeout-download.usercontent.google.com' --user-agent ...'https://takeout-download.usercontent.google.com/download/takeout-20250303T133330Z-011.zip?j=1162e805-3b09-494c-ba99-6bb0bb7719b9&i={{index}}&user=779537051113&authuser=0' --out 'takeout-20250303T133330Z-{{index}}.zip'"
for i in range(50):
print(i)
if Path(f"takeout-20250303T133330Z-{i}.zip").exists() and not Path(f"takeout-20250303T133330Z-{i}.zip.aria2").exists():
print(f"takeout-20250303T133330Z-{i}.zip exists")
continue
url = f"https://accounts.google.com/AccountChooser?continue=https://takeout.google.com/settings/takeout/download?j%3D1162e805-3b09-494c-ba99-6bb0bb7719b9%26i%3D{i}&[email protected]"
# download to photos_{i}.zip
command = command_template.replace("{{index}}", str(i))
subprocess.run(command, shell=True)
- 现在我们下下来一堆 zip 文件,我们批量解压(因为这个 zip 根本不是 strip 压缩包,而只是多个单独的压缩文件
for file in *.zip
7z x "$file"
end - 然后我们用 Google Photos Takeout Helper 去转换
- 修复时间戳:
gpth-linux --fix Takeout/
gpth-linux --input Takeout/ --output photo/ --albums "shortcut"
- 修复目标的时间戳:
gpth-linux --fix photo/
- 修复时间戳:
导入 iCloud Photo
- 接下在我们配置一个 macOS 的虚拟机来上传照片。rclone 等第三方是可以传 iCloud (这里也不是 Photo),但是很慢,实测需要3天
- Follow ultimate-macOS-KVM
- 跟着 README 去安装好(一定不要只分配80G,我留了256G,按照你需要传的照片看)(我这里选择 OSX14),登录你自己的国区 iCloud 帐号
- 启用 SSH :Allow a remote computer to access your Mac
- 编辑 boot.sh 虚拟机启动脚本
############## REMOVE THESE LINES AFTER MACOS INSTALLATION ###############
#-drive id=BaseSystem,if=none,file="$VM_PATH/BaseSystem.img",format=raw
#-device ide-hd,bus=sata.4,drive=BaseSystem
##########################################################################
-netdev user,id=net0,hostfwd=tcp::5555-:22 -device "$NETWORK_DEVICE",netdev=net0,id=net0,mac="$MAC_ADDRESS"
-device qxl-vga,vgamem_mb=128,vram_size_mb=128
-monitor stdio 然后我们可以宿主机登录了:
ssh <your-name>@localhost -p 5555
- 编辑 boot.sh 虚拟机启动脚本
- 运行一个在 photo 文件夹下 WebDAV 服务器,并转发端口到 macOS 里
rclone serve webdav --addr :8080 .
ssh -R 8080:127.0.0.1:8080 <your-name>@localhost -p 5555
- macOS 里挂载 WebDAV:Mounting a Shared Folder Using WebDAV on Mac
- 使用 macOS 里的 photo 软件导入图片们,一定要使用这个方法:Reddit r/applehelp
- 接下来就是等着咯,实测我150G,11k 照片需要一整天
- 关闭 Mac 节能,避免上传暂停 Set sleep and wake settings for your Mac
- 然后,等着
- 关闭 Mac 节能,避免上传暂停 Set sleep and wake settings for your Mac
结语
作为一个极客,我们肯定要调查清楚我们是否有退路,也就是导出数据的方法。同样,Mac 虚拟机
综上,苹果,一个好的设计公司,也是一个垃圾的科技公司。
发表回复