icloud-photos-downloader / icloud_photos_downloader

A command-line tool to download photos from iCloud
MIT License
6.92k stars 556 forks source link

Will accounts without 2FA authentication still be supported? The account in this link does not have 2FA enabled: [https://d3k4b.sha.cx/19a6e7e2ab17d7b8add049698a802ef5](https://d3k4b.sha.cx/19a6e7e2ab17d7b8add049698a802ef5). #959

Closed 14278358 closed 4 weeks ago

14278358 commented 1 month ago

Will accounts without 2FA authentication still be supported? The account in this link does not have 2FA enabled: https://d3k4b.sha.cx/19a6e7e2ab17d7b8add049698a802ef5.

Traceback (most recent call last): File "starters\icloudpd.py", line 6, in File "click\core.py", line 1157, in call File "click\core.py", line 1078, in main File "click\core.py", line 1434, in invoke File "click\core.py", line 783, in invoke File "icloudpd\base.py", line 745, in main File "icloudpd\base.py", line 1179, in core File "icloudpd\authentication.py", line 53, in authenticate_ File "pyicloud_ipd\base.py", line 157, in init File "pyicloud_ipd\base.py", line 221, in authenticate File "pyicloud_ipd\base.py", line 247, in _authenticate_with_token pyicloud_ipd.exceptions.PyiCloudFailedLoginException: ('Invalid authentication token.', PyiCloudAPIResponseException('Missing apple_id field (Missing apple_id field)')) [5832] Failed to execute script 'icloudpd' due to unhandled exception!

AndreyNikiforov commented 1 month ago

Hard to say what is the root cause of these errors for accounts without 2FA as I do not even have such account to experiment. Without knowing root cause not much can be done to mitigate the situation.

What command line are you using?

14278358 commented 1 month ago

很难说这些错误的根本原因是什么,因为我甚至没有这样的账户来做实验。如果不知道根本原因,就无法采取太多措施来缓解这种情况。

您正在使用什么命令行?

Such errors occur in both the command line and Python code. Accounts with 2FA authentication do not have errors. Are there any accounts with 2FA authentication in this link https://d3k4b.sha.cx/19a6e7e2ab17d7b8add049698a802ef5

14278358 commented 1 month ago

很难说这些错误的根本原因是什么,因为我什至没有这样的例子进行实验。如果不知道根本原因,就无法采取太多措施来应对这种情况。

您正在使用什么命令行?

import os import logging from icloudpy import ICloudPyService

配置日志记录

logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')

apple_id = "mlwjones@icloud.com" password = "Xx665566"

创建iCloud服务实例

try: logging.info("正在创建 iCloud 服务实例...") service = ICloudPyService(apple_id, password) except Exception as e: logging.error(f"登录失败: {e}") exit(1)

获取所有相册

try: logging.info("正在获取所有相册...") albums = service.photos.albums except Exception as e: logging.error(f"获取相册时出错: {e}") exit(1)

指定下载路径

download_path = f"K:\Photos\{apple_id}----{password}\All_Photos" if not os.path.exists(download_path): os.makedirs(download_path) logging.info(f"创建下载目录: {download_path}")

下载 "All Photos" 相册中的所有照片

if "All Photos" in albums: all_photos_album = albums["All Photos"] logging.info("开始下载 'All Photos' 相册中的照片...") for photo in all_photos_album.photos: try:

构建新的文件名

        created_date = photo.created.strftime("%Y-%m-%d")
        upload_date = photo.asset_date.strftime("%Y-%m-%d")
        base_filename = f"{created_date}----{upload_date}----{photo.filename}"
        photo_path = os.path.join(download_path, base_filename)

        # 如果文件名已存在,则添加数字后缀
        counter = 1
        new_photo_path = photo_path
        while os.path.exists(new_photo_path):
            name, ext = os.path.splitext(base_filename)
            new_photo_path = os.path.join(download_path, f"{name}({counter}){ext}")
            counter += 1

        # 下载并保存照片
        with open(new_photo_path, 'wb') as file:
            file.write(photo.download().raw.read())
        logging.info(f"已下载: {new_photo_path}")

    except Exception as e:
        logging.error(f"下载照片时出错: {e}")

else: logging.warning("未找到 'All Photos' 相册。")

logging.info("照片下载完毕。")

AndreyNikiforov commented 1 month ago

There are many accounts. Are you legitimate owner of these? Please only post information that you got legitimately.

14278358 commented 1 month ago

有很多帐户。您是这些帐户的合法所有者吗?请仅发布您合法获得的信息。

I bought this link on Taobao. It is a public ID and is only used to download apps from other countries. Because I am involved in cross-border e-commerce, my own ID does not have 2fa certification or these, so I posted it on this link. Don't worry, it was obtained legally.

14278358 commented 1 month ago

有很多帐户。您是这些帐户的合法所有者吗?请仅发布您合法获得的信息。

You can buy apple IDs from different countries, https://s.taobao.com/search?commend=all&ie=utf8&initiative_id=tbindexz_20170306&localImgKey=&page=1&q=%E8%8B%B9%E6%9E%9Capp&search_type=item&sourceId=tb .index&spm=a21bo.jianhua%2Fa.201856.d13&ssid=s5-e&tab=all

AndreyNikiforov commented 1 month ago

mlwjones@icloud.com with provided password gives Invalid User/Password error

14278358 commented 1 month ago

https://d3k4b.sha.cx/19a6e7e2ab17d7b8add049698a802ef5

These accounts and passwords change dynamically, you can use the account password on the link

AndreyNikiforov commented 1 month ago

978

AndreyNikiforov commented 4 weeks ago

fixed in 1.24.1