Airpods

コマンドラインからiCloud写真をダウンロードする方法

コマンドラインからiCloud写真をダウンロードする方法

コマンドライン経由でiCloud写真をダウンロードする

コマンドラインを使ってiCloudフォトからすべての写真をダウンロードしたいと思ったことはありませんか?サードパーティ製のツール「icloud_photos_downloader」を使えば、まさにそれが実現できます。略して「icloudpd」と呼ばれるこのツールは、Mac、Windows PC、Linuxのコマンドラインを使ってiCloudから直接写真にアクセスし、ダウンロードできます。

icloudpd はオープンソースなので、興味があれば github でソース プロジェクトを確認できます。

icloud_photos_downloader はPythonツールなので、MacにPython 3.xまたはHomebrewをインストールしておく必要があります(まだインストールしていない場合)。ここではMacでHomebrewを使用していることを前提としていますが、他のツールをお使いの場合は、適切なインストール方法に従ってください。

まず、MacにPythonをインストールする必要があります(まだインストールしていない場合)。既にPythonをインストールしている場合は、この手順をスキップできます。

brew install python

Python のインストールが完了したら、次のコマンドを使用して、pip で icloud_photos_downloader パッケージをインストールできます。

pip install icloudpd

icloudpd のインストールが完了したら、準備完了です。

コマンドラインですべてのiCloud写真をダウンロードする方法

icloudpd をインストールしたら、iCloud API を使用して iCloud フォトから直接写真をダウンロードできるようになります。

写真をダウンロードするディレクトリを指定し、次のように Apple ID とパスワードも含める必要があります。

icloudpd --directory ~/iCloudPhotoBackup \
--username [email protected] \
--password examplepassword123 \

これにより、すべての写真が iCloud フォトから宛先ディレクトリにダウンロードされます。

ダウンロードを完了するために十分なディスク容量と帯域幅があることを確認してください。写真が多いとダウンロードに非常に長い時間がかかる場合があります。10万枚以上の写真が350GBのストレージ容量を占めている場合は、ダウンロードが完了するまでしばらくお待ちください。

完了したら、ダウンロードしたディレクトリを確認して、

iCloud からすべての写真をダウンロードする方法は他にもあります。たとえば、iCloud フォト機能をオフにして Mac で iCloud からすべての写真をダウンロードする、同様の操作を実行して iCloud から iPhone または iPad にすべての写真をダウンロードする、iCloud.com Web サイトのダウンロード機能を使用する (残念ながら一度に 1000 枚の写真に制限されるため、大きな写真ライブラリを持つユーザーには実用的ではありません)、Mac の写真で iCloud フォトの「オリジナルをダウンロード」設定を使用する (この場合も、十分なディスク容量があることを確認してください)、Apple の GDPR データ要求ツールを使用して、iCloud フォトを含む Apple があなたから持っているすべてのもののコピーを要求することもできます。

ご参考までに、icloudpd には iCloud フォトから写真を選択的にダウンロードするためのオプションやフラグが他にもたくさんあります。icloudpd –help を実行すると、以下のオプションが表示されます。

Usage: icloudpd.py options

Download all iCloud photos to a local directory

Options:
-d, --directory directory Local directory that should be used for
download
-u, --username username Your iCloud username or email address
-p, --password password Your iCloud password (default: use PyiCloud
keyring or prompt for password)
--cookie-directory /cookie/directory
Directory to store cookies for
authentication (default: ~/.pyicloud)
--size [original|medium|thumb] Image size to download (default: original)
--live-photo-size [original|medium|thumb]
Live Photo video size to download (default:
original)
--recent INTEGER RANGE Number of recent photos to download
(default: download all photos)
--until-found INTEGER RANGE Download most recently added photos until we
find x number of previously downloaded
consecutive photos (default: download all
photos)
-a, --album album Album to download (default: All Photos)
-l, --list-albums Lists the avaliable albums
--skip-videos Don't download any videos (default: Download
all photos and videos)
--skip-live-photos Don't download any live photos (default:
Download live photos)
--force-size Only download the requested size (default:
download original if size is not available)
--auto-delete Scans the "Recently Deleted" folder and
deletes any files found in there. (If you
restore the photo in iCloud, it will be
downloaded again.)
--only-print-filenames Only prints the filenames of all files that
will be downloaded (not including files that
are already downloaded.)(Does not download
or delete any files.)
--folder-structure folder_structure
Folder structure (default: {:%Y/%m/%d})
--set-exif-datetime Write the DateTimeOriginal exif tag from
file creation date, if it doesn't exist.
--smtp-username smtp_username
Your SMTP username, for sending email
notifications when two-step authentication
expires.
--smtp-password smtp_password
Your SMTP password, for sending email
notifications when two-step authentication
expires.
--smtp-host smtp_host Your SMTP server host. Defaults to:
smtp.gmail.com
--smtp-port smtp_port Your SMTP server port. Default: 587 (Gmail)
--smtp-no-tls Pass this flag to disable TLS for SMTP (TLS
is required for Gmail)
--notification-email notification_email
Email address where you would like to
receive email notifications. Default: SMTP
username
--notification-script PATH Runs an external script when two factor
authentication expires. (path required:
/path/to/my/script.sh)
--log-level [debug|info|error] Log level (default: debug)
--no-progress-bar Disables the one-line progress bar and
prints log messages on separate lines
(Progress bar is disabled by default if
there is no tty attached)
--threads-num INTEGER RANGE Number of cpu threads (default: 1)
--version Show the version and exit.
-h, --help Show this message and exit.

ご覧のとおり、カスタマイズ可能なオプションがかなりたくさん用意されていますが、これは、バックアップ、アーカイブ、その他の目的で、iCloud からローカルデバイスまたはストレージにすべての写真をダウンロードしたいだけのほとんどのユーザーのニーズを超えている可能性があります。

iCloudフォトからすべての写真をダウンロードするのにicloud_photos_downloaderを使っていますか?別の方法を使いましたか?ダウンロードしたライブラリのサイズはどれくらいでしたか?コメント欄であなたの経験やご意見をお聞かせください。