Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downloading issue #110

Open
johnlescault opened this issue Jul 21, 2022 · 15 comments
Open

Downloading issue #110

johnlescault opened this issue Jul 21, 2022 · 15 comments

Comments

@johnlescault
Copy link

johnlescault commented Jul 21, 2022

This seems to be different than issue: #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.

@mkb79
Copy link
Owner

mkb79 commented Jul 21, 2022

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
Copy link
Owner

mkb79 commented Jul 21, 2022

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

@johnlescault
Copy link
Author

That worked perfectly! Thanks for the ridiculous quick reply!

@johnlescault
Copy link
Author

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 johnlescault reopened this Jul 23, 2022
@mkb79
Copy link
Owner

mkb79 commented Jul 23, 2022

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.

@johnlescault
Copy link
Author

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)?

@mkb79
Copy link
Owner

mkb79 commented Jul 24, 2022

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

@johnlescault
Copy link
Author

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

@mkb79
Copy link
Owner

mkb79 commented Jul 25, 2022

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

@mkb79
Copy link
Owner

mkb79 commented Jul 25, 2022

@johnlescault
Which marketplace (country) you use?

Edit:
Found it myself in previous comments from you.

@mkb79
Copy link
Owner

mkb79 commented Jul 25, 2022

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
Copy link
Owner

mkb79 commented Jul 25, 2022

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

@mkb79
Copy link
Owner

mkb79 commented Jul 25, 2022

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.

Repository owner deleted a comment from johnlescault Jul 25, 2022
@mkb79
Copy link
Owner

mkb79 commented Jul 25, 2022

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

@johnlescault
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants