diff --git a/icloudpd/authentication.py b/icloudpd/authentication.py index ef33f5006..f5d7042b9 100644 --- a/icloudpd/authentication.py +++ b/icloudpd/authentication.py @@ -19,7 +19,8 @@ def authenticate( password, cookie_directory=None, raise_error_on_2sa=False, - client_id=None + client_id=None, + china_mainland=False, ): """Authenticate with iCloud username and password""" logger = setup_logger() @@ -30,7 +31,9 @@ def authenticate( icloud = pyicloud.PyiCloudService( username, password, cookie_directory=cookie_directory, - client_id=client_id) + client_id=client_id, + china_mainland=china_mainland, + ) except PyiCloudNoStoredPasswordAvailableException: # Prompt for password if not stored in PyiCloud's keyring password = click.prompt("iCloud Password", hide_input=True) diff --git a/icloudpd/base.py b/icloudpd/base.py index 6ed29ff86..485a4d349 100755 --- a/icloudpd/base.py +++ b/icloudpd/base.py @@ -50,6 +50,10 @@ "(default: use PyiCloud keyring or prompt for password)", metavar="", ) +@click.option("--china-mainland", + help="The country or region setting of your Apple ID is 'China mainland'(中国大陆)", + is_flag=True, + ) @click.option( "--cookie-directory", help="Directory to store cookies for authentication " @@ -200,6 +204,7 @@ def main( directory, username, password, + china_mainland, cookie_directory, size, live_photo_size, @@ -258,6 +263,7 @@ def main( cookie_directory, raise_error_on_2sa, client_id=os.environ.get("CLIENT_ID"), + china_mainland=china_mainland, ) except TwoStepAuthRequiredError: if notification_script is not None: