audible-cli icon indicating copy to clipboard operation
audible-cli copied to clipboard

Downloading issue

Open johnlescault opened this issue 2 years ago • 15 comments

This seems to be different than issue: https://github.com/mkb79/audible-cli/issues/103

I am getting error: Bad Request (400): 1 validation error detected: Value 'Extreme' at 'quality' failed to satisfy constraint: Member must satisfy enum value set: [High, Normal]

However when using the Android Audible App I am still able to download the book.

Is there a new limit being imposed by Audible per device? (audible-cli being one device and my android being a different with different limit)

Just curious if anyone else has had this happen?

Edit: The only file I am able to download is the jpg cover file - all other files give that error.

johnlescault avatar Jul 21 '22 20:07 johnlescault

The AudibleAPI does not allow Extreme as quality setting anymore. I've fixed that in the master branch. A new version is not released yet. So you have to install it from GitHub master branch.

mkb79 avatar Jul 21 '22 20:07 mkb79

FYI: The High quality will give the same as the Extreme quality. So there is no difference in the given audiobooks.

mkb79 avatar Jul 21 '22 21:07 mkb79

That worked perfectly! Thanks for the ridiculous quick reply!

johnlescault avatar Jul 21 '22 23:07 johnlescault

Hi, not sure if this is the same issue so I re-opened this ticket. These are for books in the Plus Catelog. I am getting the following errors:

audible -v error download --all --aaxc --cover --cover-size 1215 --chapter --pdf --jobs 5 --bunch-size 200
error: 'license_response'
error: 'license_response'
error: 'license_response'
Play_Time_for_Puppy_Hello_Genius-AAX_44_128.aaxc: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 110/110 [00:01<00:00, 86.5B/s]
error: Error downloading /mnt/12tb_1/Audible RIPs/0Audible Plus RAW/Play_Time_for_Puppy_Hello_Genius-AAX_44_128.aaxc. Message: <?xml version="1.0" encoding="UTF-8"?><Error><Code>AccessDenied</Code><Message>Access denied</Message></Error>]
I_Want_to_Be_a_Crocodile_I_Want_to_Be...-AAX_44_128.aaxc: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 110/110 [00:01<00:00, 75.3B/s]
error: Error downloading /mnt/12tb_1/Audible RIPs/0Audible Plus RAW/I_Want_to_Be_a_Crocodile_I_Want_to_Be...-AAX_44_128.aaxc. Message: <?xml version="1.0" encoding="UTF-8"?><Error><Code>AccessDenied</Code><Message>Access denied</Message></Error>ean_on_the_Moon-AAX_44_128.aaxc:   0%|                                                                                                                                                                       | 0.00/110 [00:00<?, ?B/s]
No_Snow_for_Christmas-AAX_44_128.aaxc: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 110/110 [00:01<00:00, 73.0B/s]
error: Error downloading /mnt/12tb_1/Audible RIPs/0Audible Plus RAW/No_Snow_for_Christmas-AAX_44_128.aaxc. Message: <?xml version="1.0" encoding="UTF-8"?><Error><Code>AccessDenied</Code><Message>Access denied</Message></Error>
What_If_There_Were_No_Lemmings_A_Book_About_the_Tundra_Ecosystem_(Food_Chain_Reactions)-AAX_44_128.aaxc: 100%|████████████████████████████████████████████████████████████████████████████████████████████████| 110/110 [00:01<00:00, 64.7B/s]
error: Error downloading /mnt/12tb_1/Audible RIPs/0Audible Plus RAW/What_If_There_Were_No_Lemmings_A_Book_About_the_Tundra_Ecosystem_(Food_Chain_Reactions)-AAX_44_128.aaxc. Message: <?xml version="1.0" encoding="UTF-8"?><Error><Code>AccessDenied</Code><Message>Access denied</Message></Error>████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 110/110 [00:01<00:00, 75.1B/s]
Tuckerbean_on_the_Moon-AAX_44_128.aaxc: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 110/110 [00:01<00:00, 58.6B/s]
error: Error downloading /mnt/12tb_1/Audible RIPs/0Audible Plus RAW/Tuckerbean_on_the_Moon-AAX_44_128.aaxc. Message: <?xml version="1.0" encoding="UTF-8"?><Error><Code>AccessDenied</Code><Message>Access denied</Message></Error>
Mouse_Says_Sorry_Hello_Genius-AAX_44_128.aaxc: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 110/110 [00:01<00:00, 58.3B/s]
error: Error downloading /mnt/12tb_1/Audible RIPs/0Audible Plus RAW/Mouse_Says_Sorry_Hello_Genius-AAX_44_128.aaxc. Message: <?xml version="1.0" encoding="UTF-8"?><Error><Code>AccessDenied</Code><Message>Access denied</Message></Error>
error: 'license_response'
error: 'license_response'

johnlescault avatar Jul 23 '22 16:07 johnlescault

That’s not the same issue. The error message indicates, that you don’t have permission to download these books. do you know how to add plugins to audible-cli? If yes, I wrote one who gives you more log messages.

mkb79 avatar Jul 23 '22 17:07 mkb79

Sorry for my ignorance, but is it just copying the following files:

cmd_get-annotations.py cmd_goodreads-transform.py cmd_image-urls.py cmd_listening-stats.py cmd_remove-encryption.py convert_oa_cred.py

in the app direction? (in my case linux ~/.audible/plugins)?

johnlescault avatar Jul 23 '22 22:07 johnlescault

Yes. But instead of copying these files, I would give you a prepared download command file.

mkb79 avatar Jul 24 '22 06:07 mkb79

Ok sure we can do that for sure then. What link do I download the file from?

johnlescault avatar Jul 24 '22 11:07 johnlescault

During the day (UTC+02:00), I will put the source code in this thread

mkb79 avatar Jul 25 '22 04:07 mkb79

@johnlescault Which marketplace (country) you use?

Edit: Found it myself in previous comments from you.

mkb79 avatar Jul 25 '22 05:07 mkb79

Please copy the content below to cmd_test-license.py in your plug-in dir and run audible test-license! Is there something malformed in response data? Is the license granted?

import json

import click
from audible.aescipher import decrypt_voucher_from_licenserequest
from audible_cli.decorators import (
    bunch_size_option,
    timeout_option,
    pass_client,
    pass_session
)
from audible_cli.models import Library


CLIENT_HEADERS = {
    "User-Agent": "Audible/671 CFNetwork/1240.0.4 Darwin/20.6.0"
}


@click.command("test-license")
@timeout_option
@bunch_size_option
@pass_session
@pass_client(headers=CLIENT_HEADERS)
async def cli(session, api_client):
    """test license #110"""
    bunch_size = session.params.get("bunch_size")
    library = await Library.from_api_full_sync(
        api_client,
        image_sizes="1215, 408, 360, 882, 315, 570, 252, 558, 900, 500",
        bunch_size=bunch_size
    )

    titles = (
        "Play Time for Puppy Hello Genius",
        "No snow for Christmas",
        "Tuckerbean on the Moon",
        "Mouse Says Sorry Hello Genius",
        "I want to be a crocodile"
    )

    for title in titles:
        click.echo(50 * "*")
        click.echo(f"Current title: {title}")

        match = library.search_item_by_title(title)
        full_match = [i for i in match if i[1] == 100]
        search_match = full_match if full_match else match

        # selecting first match only
        try:
            item = search_match[0][0]
        except IndexError:
            click.echo("Could not find these item in library")
            continue

        click.echo(f"Matched title: {item.full_title}")
        click.echo(f"title asin: {item.asin}")

        body = {
            "supported_drm_types": ["Mpeg", "Adrm"],
            "quality": "High",
            "consumption_type": "Download",
            "response_groups": "content_reference"
        }

        click.echo("Requesting license")
        license_response = await api_client.post(
            f"content/{item.asin}/licenserequest",
            body=body,
            response_callback=lambda x: x
        )
        status_code = license_response.status_code

        click.echo(f"License response status code: {status_code}")        

        try:
            response_data = license_response.json()
        except json.JSONDecodeError:
            response_data = license_response.text
        else:
            try:
                voucher = decrypt_voucher_from_licenserequest(
                    api_client.auth, response_data
                )
            except:
                pass
            else:
                response_data["content_license"]["license_response"] = voucher

        if isinstance(response_data, dict):
            response_data = json.dumps(response_data, indent=4)

        click.echo("Got the following response data:")
        click.echo(response_data)

mkb79 avatar Jul 25 '22 08:07 mkb79

That's really strange. The license for the book is granted. But it seams that the downloads are failing.

mkb79 avatar Jul 25 '22 17:07 mkb79

I've one idea. Can you run the command with --jobs 1. Maybe the number of simultaneous jobs are too high. The Audible app for iOS download a limited number of books for the same time.

mkb79 avatar Jul 25 '22 17:07 mkb79

@johnlescault I've deleted your last message because it contained some download urls and key/iv values.

mkb79 avatar Jul 25 '22 18:07 mkb79

Adding --jobs to test-licence gave the following error:

Usage: audible test-license [OPTIONS]
Try 'audible test-license -h' for help.

Error: No such option: --jobs

I also added it to my normal "audible -v error download --all --aaxc --cover --cover-size 1215 --chapter --pdf --jobs 1 --bunch-size 200 --ignore-errors" and received the same results with the errors.

johnlescault avatar Jul 25 '22 19:07 johnlescault