mkb79 / audible-cli

A command line interface for audible package. With the cli you can download your Audible books, cover, chapter files.
GNU Affero General Public License v3.0
423 stars 45 forks source link

Unable to setup up, CVF code, and uncaught exception #167

Closed cannyboy closed 7 months ago

cannyboy commented 8 months ago

Trying to set up with audible quickstart like so

Please enter a name for your primary profile [audible]: 
Enter a country code for the profile: uk
Please enter a name for the auth file [audible.json]: 
Do you want to encrypt the auth file? [y/N]: 
Do you want to login with external browser? [y/N]: 
Do you want to login with a pre-amazon Audible account? [y/N]: 
Please enter your amazon username: example@gmail.com
Please enter your amazon password: 
Repeat for confirmation: 

+--------------------+-------------------------+
| Option             | Value                   |
+--------------------+-------------------------+
| profile_name       | audible                 |
| auth_file          | audible.json            |
| country_code       | uk                      |
| auth_file_password | -                       |
| audible_username   | example@gmail.com |
| audible_password   | ***                     |
+--------------------+-------------------------+
Do you want to continue? [y/N]: y
Login with amazon to your audible account now.
CVF Code:

Don't know why it's asking for CVF code, since I don't get any email/text from Amazon/Audible.

So I just press enter, and I get this:

Uncaught Exception
Traceback (most recent call last):
  File "/Users/cannyboy/.pyenv/versions/3.9.0/Python.framework/Versions/3.9/lib/python3.9/site-packages/audible_cli/cli.py", line 46, in quickstart
    sys.exit(ctx.forward(cmd_quickstart.cli))
  File "/Users/cannyboy/.pyenv/versions/3.9.0/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 804, in forward
    return __self.invoke(__cmd, *args, **kwargs)
  File "/Users/cannyboy/.pyenv/versions/3.9.0/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/cannyboy/.pyenv/versions/3.9.0/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/Users/cannyboy/.pyenv/versions/3.9.0/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/cannyboy/.pyenv/versions/3.9.0/Python.framework/Versions/3.9/lib/python3.9/site-packages/audible_cli/cmds/cmd_quickstart.py", line 162, in cli
    build_auth_file(
  File "/Users/cannyboy/.pyenv/versions/3.9.0/Python.framework/Versions/3.9/lib/python3.9/site-packages/audible_cli/utils.py", line 102, in build_auth_file
    auth = Authenticator.from_login(
  File "/Users/cannyboy/.pyenv/versions/3.9.0/Python.framework/Versions/3.9/lib/python3.9/site-packages/audible/auth.py", line 408, in from_login
    login_device = login(
  File "/Users/cannyboy/.pyenv/versions/3.9.0/Python.framework/Versions/3.9/lib/python3.9/site-packages/audible/login.py", line 500, in login
    raise Exception("Login failed. Please check the log.")
Exception: Login failed. Please check the log.
mkb79 commented 8 months ago

@cannyboy Amazon response to a login request with a html page. My program then try to analyze this page by searching for tags with specific id‘s.

In your case, the page contains a div tag with the id cvf-page-content. Maybe Amazon has changed his page and my program can not detect the current page correctly.

So my question is, have you 2FA enabled for your account? If you have 2FA enabled you can append your OTP to your password when you are asked for it.

As a workaround you can use the external login method. For this you have to run audible quickstart and answer the question Do you want to login with external browser? with y. This should work for you.

cannyboy commented 8 months ago

thanks @mkb79 , you're the best. I used the external browser method, since 2FA was not enabled.

(my next problem is getting creating m4b files. ffmpeg only making silent files at the moment)

mkb79 commented 8 months ago

I used the external browser method, since 2FA was not enabled.

Great to hear that. I'll have to check what Amazon had changed for 2FA disabled accounts.

my next problem is getting creating m4b files. ffmpeg only making silent files at the moment.

What are you mean with silent files? Do you use my decrypt plugin command for audible-cli? Which ffmpeg version you are using?

cannyboy commented 8 months ago

I was trying to converting aax files I'd previously downloaded using OpenAudible, using ffmpeg:

ffmpeg -activation_bytes XXX -i inputfile.aax -c copy outputfile.m4b

... but it was just producing silent m4b files of the same length (when played on Quicktime or VLC .. macOS)

I'm going to try downloading the audiobooks with audible-cli and using the decrypt plugin to convert, and see if that works.

mkb79 commented 8 months ago

You can check an aax file with ffmpeg -stats -activation_bytes XXX -i inputfile.aax. At the bottom of the output must be a line starting with Stream #0:0(eng): Audio:. Which codec is printed out for your audiobook? Does your player software support this codec?

mkb79 commented 8 months ago

@cannyboy Please close this issue when it’s solved. Thanks.

cannyboy commented 7 months ago

issues were resolved by downloading as aaxc rather than aax (aax usually never completed the download). also downloading chapter json. and then using the decrypt plugin with -r to incorporate chapters.