audible-cli
audible-cli copied to clipboard
License not granted to customer [xxxxxxxxxxxxxx] for asin [YYYYYYY]
Hi, i was downloading my library (109 books) included in my suscription, (so, not bought audios) After 150 books, more or less i was "granted" with an error "license error"
i have tried all branches, getting some more info
It happens with all audiobooks, if i remove that (based on asin the next audiobook gives same error.
Is there a download limit? or its another thing?
PD: i have used a plugin posted on other issue, but no info related to these asin
thanks in advance
Can you try the count-aycl-files
branch with --ignore-errors
flag set? This will ignore these errors and proceed with the next.
How discussed in #115 this could be items which are not released yet? Maybe it could be a rate limit too.
So you have the asin of the books? And your marketplace?
Im using audible.es
with --ignore-errors it ignores them, and the next one and the next... until the end of the library.
items not released? i dont believe it, the option of rate limit gains power.... because i can listen to that audiobook in the website
Can you give me the output of the following command audible api -p "response_groups=product_desc,media, product_attrs,relationships,series,customer_rights,pdf_url" -i 4 library/B09ZLFY5YG
. I will check this.
And maybe you run the download command with debug messages audible -v debug download ...
?
{
"item": {
"amazon_asin": null,
"asin": "B09ZLFY5YG",
"audible_editors_summary": null,
"author_pages": null,
"authors": null,
"availability": null,
"available_codecs": [
{
"enhanced_codec": "LC_64_44100_stereo",
"format": "Enhanced",
"is_kindle_enhanced": true,
"name": "aax_44_64"
},
{
"enhanced_codec": "format4",
"format": "Format4",
"is_kindle_enhanced": false,
"name": "format4"
},
{
"enhanced_codec": "LC_128_44100_stereo",
"format": "Enhanced",
"is_kindle_enhanced": true,
"name": "aax_44_128"
},
{
"enhanced_codec": "mp44464",
"format": "Enhanced",
"is_kindle_enhanced": true,
"name": "mp4_44_64"
},
{
"enhanced_codec": "mp444128",
"format": "Enhanced",
"is_kindle_enhanced": true,
"name": "mp4_44_128"
},
{
"enhanced_codec": "aax",
"format": "Enhanced",
"is_kindle_enhanced": false,
"name": "aax"
}
],
"badge_types": null,
"badges": null,
"benefit_id": "AYCL",
"buying_options": null,
"category_ladders": null,
"claim_code_url": null,
"collection_ids": null,
"content_delivery_type": "SinglePartBook",
"content_level": null,
"content_rating": null,
"content_type": "Product",
"continuity": null,
"copyright": null,
"credits_required": null,
"customer_reviews": null,
"customer_rights": {
"is_consumable": true,
"is_consumable_indefinitely": false,
"is_consumable_offline": true,
"is_consumable_until": null
},
"date_first_available": null,
"distribution_rights_region": [
"PR",
"PS",
"PT",
"PW",
"PY",
"QA",
"AD",
"AE",
"AF",
"AG",
"AI",
"AL",
"AM",
"AO",
"AQ",
"AR",
"AS",
"AT",
"RE",
"AU",
"AW",
"AX",
"AZ",
"RO",
"BA",
"BB",
"RS",
"BD",
"BE",
"RU",
"BF",
"BG",
"RW",
"BH",
"BI",
"BJ",
"BL",
"BM",
"BN",
"BO",
"SA",
"BQ",
"SB",
"BR",
"SC",
"BS",
"SD",
"BT",
"SE",
"BV",
"SG",
"BW",
"SH",
"SI",
"BY",
"SJ",
"BZ",
"SK",
"SL",
"SM",
"SN",
"SO",
"CA",
"SR",
"CC",
"SS",
"CD",
"ST",
"CF",
"SV",
"CG",
"CH",
"SX",
"CI",
"SZ",
"CK",
"CL",
"CM",
"CN",
"CO",
"CR",
"TC",
"TD",
"TF",
"CV",
"TG",
"CW",
"TH",
"CX",
"CY",
"TJ",
"CZ",
"TK",
"TL",
"TM",
"TN",
"TO",
"TR",
"TT",
"DE",
"TV",
"TW",
"DJ",
"TZ",
"DK",
"DM",
"DO",
"UA",
"UG",
"DZ",
"UM",
"EC",
"US",
"EE",
"EG",
"EH",
"UY",
"UZ",
"VA",
"ER",
"VC",
"ES",
"ET",
"VE",
"VG",
"VI",
"VN",
"VU",
"FI",
"FJ",
"FK",
"FM",
"FO",
"FR",
"WF",
"GA",
"GB",
"WS",
"GD",
"GE",
"GF",
"GG",
"GH",
"GI",
"GL",
"GM",
"GN",
"GP",
"GQ",
"GR",
"GS",
"GT",
"GU",
"GW",
"GY",
"HK",
"HM",
"HN",
"HR",
"HT",
"YE",
"HU",
"ID",
"YT",
"IE",
"IL",
"IM",
"IN",
"IO",
"ZA",
"IQ",
"IS",
"IT",
"ZM",
"JE",
"ZW",
"JM",
"JO",
"JP",
"KE",
"KG",
"KH",
"KI",
"KM",
"KN",
"KR",
"KW",
"KY",
"KZ",
"LA",
"LB",
"LC",
"LI",
"LK",
"LR",
"LS",
"LT",
"LU",
"LV",
"LY",
"MA",
"MC",
"MD",
"ME",
"MF",
"MG",
"MH",
"MK",
"ML",
"MM",
"MN",
"MO",
"MP",
"MQ",
"MR",
"MS",
"MT",
"MU",
"MV",
"MW",
"MX",
"MY",
"MZ",
"NC",
"NE",
"NF",
"NG",
"NI",
"NL",
"NO",
"NP",
"NR",
"NU",
"NZ",
"OM",
"PA",
"PE",
"PF",
"PG",
"PH",
"PK",
"PL",
"PM",
"PN"
],
"editorial_reviews": null,
"episode_count": null,
"episode_number": null,
"episode_type": null,
"extended_product_description": null,
"format_type": "unabridged",
"generic_keyword": null,
"has_children": false,
"image_url": null,
"invites_remaining": null,
"is_adult_product": false,
"is_archived": null,
"is_ayce": true,
"is_buyable": true,
"is_downloaded": null,
"is_finished": null,
"is_in_wishlist": null,
"is_listenable": true,
"is_pdf_url_available": null,
"is_pending": false,
"is_playable": null,
"is_preorderable": false,
"is_purchasability_suppressed": false,
"is_released": null,
"is_removable": true,
"is_removable_by_parent": true,
"is_returnable": true,
"is_searchable": null,
"is_visible": true,
"is_world_rights": false,
"is_ws4v_companion_asin_owned": null,
"is_ws4v_enabled": null,
"isbn": null,
"issue_date": "2022-05-09",
"language": "spanish",
"library_status": {
"date_added": "2022-09-04T23:38:28.000Z",
"is_pending": false,
"is_preordered": null,
"is_removable": true,
"is_visible": true
},
"listening_status": null,
"member_giving_status": null,
"merchandising_description": null,
"merchandising_summary": "<p>Las ventas de biograf\u00edas de personajes notorios y famosos son el principal negocio de Ediciones Plutarco. Presidente, premios Nobel, actrices...</p>",
"music_id": null,
"narration_accent": null,
"narrators": null,
"new_episode_added_date": null,
"order_id": null,
"order_item_id": null,
"origin_asin": null,
"origin_id": null,
"origin_marketplace": "ALMIKO4SZCSAR",
"origin_type": null,
"part_number": null,
"participation_plans": null,
"pdf_url": null,
"percent_complete": null,
"periodical_info": null,
"plans": [
{
"customer_eligible": null,
"detail_plan_names": null,
"end_date": "2099-12-31T12:00:00.00000Z",
"plan_name": "ES-AYCL",
"start_date": "2022-05-04T13:35:00.00035Z"
}
],
"platinum_keywords": null,
"preorder_release_date": null,
"preorder_status": null,
"price": null,
"product_images": {
"500": "https://m.media-amazon.com/images/I/5173w-3dn3L._SL500_.jpg"
},
"product_page_url": null,
"product_site_launch_date": null,
"program_participation": "Audible Original",
"provided_review": null,
"publication_datetime": "2022-05-09T00:00:00Z",
"publication_name": null,
"publisher_name": null,
"publisher_summary": null,
"purchase_date": "2022-09-04T23:38:28.000Z",
"rating": null,
"read_along_support": null,
"relationships": null,
"release_date": "2022-05-09",
"review_status": null,
"runtime_length_min": 77,
"sample_url": null,
"season_number": null,
"series": null,
"sku": "BK_AOES_000039ES",
"sku_lite": "BK_AOES_000039",
"social_media_images": {
"facebook": "https://m.media-amazon.com/images/I/5173w-3dn3L._SL10_UR1600,800_CR200,50,1200,630_CLa%7C1200,630%7C5173w-3dn3L.jpg%7C0,0,1200,630+82,82,465,465_PJAdblSocialShare-Gradientoverlay-largeasin-0to70,TopLeft,0,0_PJAdblSocialShare-AudibleLogo-Large,TopLeft,600,270_OU01_ZBESCUCHANDO%20EN,617,216,52,500,AudibleSansMd,30,255,255,255.jpg",
"twitter": "https://m.media-amazon.com/images/I/5173w-3dn3L._SL10_UR1600,800_CR200,50,1024,512_CLa%7C1024,512%7C5173w-3dn3L.jpg%7C0,0,1024,512+67,67,376,376_PJAdblSocialShare-Gradientoverlay-twitter-largeasin-0to60,TopLeft,0,0_PJAdblSocialShare-AudibleLogo-Medium,TopLeft,490,223_OU01_ZBESCUCHANDO%20EN,483,152,55,450,AudibleSansMd,32,255,255,255.jpg"
},
"status": "Active",
"subscription_asins": null,
"subtitle": null,
"text_to_speech": null,
"thesaurus_subject_keywords": [
"audible_original",
"literature-and-fiction"
],
"title": "El Bi\u00f3grafo",
"voice_description": "Castilian Spanish",
"ws4v_companion_asin": null
},
"response_groups": [
"relationships",
"customer_rights",
"product_desc",
"always-returned",
"origin",
"library_status",
"series",
"pdf_url",
"media",
"product_attrs"
]
}
when adding -v DEBUG flag....
That looks inconspicuous.
Can you try audible api -m post -b '{"supported_drm_types": ["Dash", "HlsCmaf", "Hls", "Mpeg"], "quality": "High", "consumption_type": "Streaming", "response_groups": "last_position_heard, pdf_url, content_reference"}' -i 4 content/B09ZLFY5YG/licenserequest
please. This makes a streaming license request. Maybe these title can only be streamed?!
{ "content_license": { "acr": "CR!EW7PW3DQPD3VH65TTDJSXA3W96F7", "asin": "B09ZLFY5YG", "content_metadata": { "content_reference": { "acr": "CR!EW7PW3DQPD3VH65TTDJSXA3W96F7", "asin": "B09ZLFY5YG", "content_format": "M4A_AAX_44", "content_size_in_bytes": 74357293, "file_version": "1", "marketplace": "ALMIKO4SZCSAR", "sku": "BK_AOES_000039", "tempo": "1.0", "version": "39908921" }, "last_position_heard": { "status": "DoesNotExist" } }, "drm_type": "Dash", "license_id": "ced49de7-ab9c-44ec-998e-0523fc009a2b", "license_response": "https://d1jobzhhm62zby.cloudfront.net/bk_aoes_000039/39908921/signed/g1/bk_aoes_000039_44,128_v8.master.mpd?ss_sec=20&iss_sec=10&isc=1&id=ced49de7-ab9c-44ec-998e-0523fc009a2b&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=MD1BAJ27VEMQ8GGY7BZB/20220905/us-east-1/cloudfront/aws4_request&X-Amz-Date=20220905T115924Z&X-Amz-Expires=60&X-Amz-SignedHeaders=host&X-Amz-Signature=75e2e7683694a9348304039694b54086833596488ffe6750c6fe487aa64c079c", "message": "Customer [A2J3RR50AFBV7G] has rights to asin [B09ZLFY5YG] for AYCL", "request_id": "0e89c8d2-c5cf-41c9-96b9-e16a8d9ecfd5_7WNBR3J8K22WE14ZBSZ8", "requires_ad_supported_playback": false, "status_code": "Granted" }, "response_groups": [ "always-returned", "last_position_heard", "pdf_url", "content_reference" ] }
Thank you. The streaming license is granted but the download license not. Maybe there are two reasons for this:
- There is a rate limit for downloads
- This item is only streamable and not downloadable.
Can you download this item via the Audible App for mobile device or PC? I would suggest, you try it again tomorrow. If you could download it, then it’s a rate limit. Otherwise I would think it is only streamable.
I have tried to download from mobile app. it does nothing, with that audiobook, or any of the ones that I have previously download. So... rate limit? xD
Its there anyway to bypass it (tomorrow, when limits were gone) does bunch-size avoid it?
In my experience it is a limit. If you wait 12-24 hours it should allow you to continue.
@tdguchi
Its there anyway to bypass it (tomorrow, when limits were gone) does bunch-size avoid it?
The bunch size has another meaning. At the beginning of the download command, your whole library is requested and returned from the server in JSON-format. The library of some users are very big (thousands of books)! With the bunch-size option you can set the size, how many items will returned from the server. If you have 400 items and set a bunch-size of 200, it needs two requests to get them all. If you set the size to 400, it will get them with only one request. A higher bunch size will result in network errors, if you have a slow network connection.
@johnlescault
In my experience it is a limit. If you wait 12-24 hours it should allow you to continue.
I'm thinking so too. But the response body does not indicate such a rate limit. Maybe the headers do?
@tdguchi Can you try a plug-in script where I output the response headers?
which one plug-in?
@tdguchi
Please copy the copy below to a file in your plug-in dir and name it cmd_get-license.py
and then run it with audible get-license B09ZLFY5YG
import secrets
from typing import Dict, Union
import click
import httpx
from audible.client import convert_response_content
from audible_cli.decorators import pass_client
def response_callback(resp: httpx.Response) -> Union[Dict, str]:
return convert_response_content(resp), resp.headers
@click.command("get-license")
@click.argument("asin")
@pass_client
async def cli(client, asin):
response_groups = "last_position_heard, pdf_url, content_reference"
body = {
"supported_drm_types": ["Mpeg", "Adrm"],
"quality": "High",
"consumption_type": "Download",
"response_groups": response_groups
}
headers = {
"X-Amzn-RequestId": secrets.token_hex(20).upper(),
"X-ADP-SW": "37801821",
"X-ADP-Transport": "WIFI",
"X-ADP-LTO": "120",
"X-Device-Type-Id": "A2CZJZGLK2JJVM",
"device_idiom": "phone"
}
lr, headers = await client.post(
f"content/{asin}/licenserequest",
body=body,
headers=headers,
response_callback=response_callback
)
print(headers)
content_license = lr["content_license"]
status_code = content_license["status_code"]
click.echo(f"License status code: {status_code}")
if status_code == "Denied":
if "license_denial_reasons" in content_license:
for reason in content_license["license_denial_reasons"]:
message = reason.get("message", "UNKNOWN")
rejection_reason = reason.get("rejectionReason", "UNKNOWN")
validation_type = reason.get("validationType", "UNKNOWN")
click.echo(
f"License denied message for {asin}: {message}."
f"Reason: {rejection_reason}."
f"Type: {validation_type}"
)
msg = content_license["message"]
raise Exception(msg)
Edit: Forgot to print out the headers. Add this now.
Headers({'content-type': 'application/json', 'content-length': '1416', 'connection': 'keep-alive', 'server': 'Server', 'date': 'Mon, 05 Sep 2022 13:11:15 GMT', 'x-amz-rid': '*********X', 'x-amzn-requestid': '******D787D', 'x-amz-date': 'Mon, 05 Sep 2022 13:11:15 GMT', 'vary': 'Content-Type,Accept-Encoding,X-Amzn-CDN-Cache,X-Amzn-AX-Treatment,User-Agent', 'strict-transport-security': 'max-age=300; includeSubDomains; preload', 'permissions-policy': 'interest-cohort=()', 'x-cache': 'Miss from cloudfront', 'via': '1.1 96067a94609f0eba55814e78a68eeb7e.cloudfront.net (CloudFront)', 'x-amz-cf-pop': 'MAD56-P3', 'x-amz-cf-id': 'b**************NHBnFjgoUPvA=='}) License status code: Denied License denied message for B09ZLFY5YG: Customer [*************] has rights to asin [B09ZLFY5YG] for AYCL.Reason: UNKNOWN.Type: AYCL License denied message for B09ZLFY5YG: Customer [*************] is not part of any plans..Reason: RequesterEligibility.Type: Membership License denied message for B09ZLFY5YG: Since ClientId is null, skipping client rights validation.AAAClientId[ApolloEnv:AudibleApiExternalRouterService/EU/Prod], does not has access to asin[B09ZLFY5YG]..Reason: RequesterEligibility.Type: Client License denied message for B09ZLFY5YG: Ownership: User [*************] does not has Ownership rights for asin [B09ZLFY5YG]..Reason: RequesterEligibility.Type: Ownership Uncaught Exception Traceback (most recent call last): File "/home/papimami/.local/lib/python3.10/site-packages/audible_cli/cli.py", line 60, in main sys.exit(cli(*args, **kwargs)) File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__ return self.main(*args, **kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke return __callback(*args, **kwargs) File "/usr/lib/python3/dist-packages/click/decorators.py", line 84, in new_func return ctx.invoke(f, obj, *args, **kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke return __callback(*args, **kwargs) File "/home/papimami/.local/lib/python3.10/site-packages/audible_cli/decorators.py", line 24, in wrapper return asyncio.run(f(*args, ** kwargs)) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete return future.result() File "/home/papimami/.local/lib/python3.10/site-packages/audible_cli/decorators.py", line 62, in wrapper return await f(*args, client, **kwargs) File "/home/papimami/.audible/plugins/cmd_get-license.py", line 60, in cli raise Exception(msg) Exception: License not granted to customer [*************] for asin [B09ZLFY5YG]
The only really striking thing on the headers is the 'strict-transport-security': 'max-age=300; includeSubDomains; preload'. I don’t get these header in my license request response headers. I checked my protocols of the last 6 months.
So we are in a dead end? XD
Im confused, one line says "customer has rights" and the following says "denied"
Also says im not part of any plan... but i have a client ID, but, again, Since ClientId is null, skipping client rights
edit: the Header diferences could caused because im on "demo" period?
You have the rights. Otherwise you don’t get a license for streaming, we've tested out. I'll test some things and will report back later.
Maybe in the meantime you could write to Audible, why you don’t can download items via the official app ;)!
I have asked them, 24h reply ....
maybe its answer could be... "you moron stop downloading our books" xD
That's great. Thank you. Unfortunately, I'm not going any further yet. This is the problem if the API is not public.
well, even if i only can download 150 audio books a day, its not a big deal, i have 20 days , i could download.. 3000 books xD
You can test it out, if you can tomorrow download this amount of items or if they downgrade it for "heavy" users ;)!
Hmm, i could download covers, and chapters.json so the problem is with aaxc only.
all goes to a max download limit reached.
Yeah,only a license request (aaxc files) for AYCL books should be affected by this. Have you one credit left? If so, you can try out and buy a book with these token and try to download it.
Credits? i dont know what that is... i have suscribed via amazon login, i have been navigating, and nothing about credits its mentioned...
edit: amazon.es -> audible.es
I does not know if you get a monthly credit for free? I've got those in my Abo.
audible.es does not have anything about credits, if I login in audible.com yes a credit menu its shown, but, im not member there. I could start a 0.00 30 days period, but, i will wait until audible.es 30 days period ends.
cheking api response, i have this:
"execution_times": 1, "index": 1, "metadata": { "alternative_description": "<p>Suscripci\u00f3n mensual.</p>\n", "alternative_name": "Gold Monthly", "barker_name": "Gold Member - Monthly", "base_plan_sku": "B07VKB274C", "benefits": [], "business_model": "Premium", "business_submodel": "Discovery", "contract_name": "GoldMonthlyFullPrice", "credit_bankable_limit": 0, "credit_revenue": 0.0, "description": "<b>AudibleListener® Gold Membership - Monthly:</b> EUR 9.99 a month.", "display_switch_asins": [], "grace_period": { "number_of_intervals": 63, "time_interval": "Day"
"metadata": { "alternative_description": "<p>Prueba gratuita.</p>\n", "alternative_name": "Prueba gratuita", "barker_name": "Prueba gratuita", "base_plan_sku": "B07VKB274C", "benefits": [], "business_model": "Premium", "business_submodel": "Discovery", "contract_name": "GoldMonthly1MFreeTrial", "credit_bankable_limit": 0, "credit_revenue": 0.0, "description": "<p>Prueba gratuita</p>\n", "display_switch_asins": [], "grace_period": { "number_of_intervals": 63, "time_interval": "Day" }, "is_auto_renew_enabled": true, "is_buyable": true, "is_credit_alert_email_enabled": false, "is_eligible_for_glg": false, "is_eligible_for_hiatus": true, "is_searchable": false, "is_vet_required": true, "is_wallet_cycling_enabled": true, "name": "Prueba gratuita", "offer_type": "FreeTrial", "plan_group_type": "Discovery", "plan_id": "B07VJJ67K3", "program_type": "Default", "soft_decline_times_to_try": 6, "soft_decline_wait_to_try_period": { "number_of_intervals": 4, "time_interval": "Day" }, "tax_price_type": "InclusiveFixedPrice" }, "renewal_policy": "no_renew"
So, saomething called gold membership, where i have a "free period"
Too bad. Otherwise, you could have bought a title with the credit and then tested the download.
after 24h, im abe to download again, so.. DIN DIN DIN we got download limit xD Also, audible has answered, nothing special, they think i dont know how to press download button and send me iinstructions to navigate inside de app..... xDDD
I will report back when the limit shows again to tell the number of books.
Hmm iis there any command to clean all library at once?
Also, how can i add a book to library using audible cli and asin?
(im not good using apis)
Also, how can i add a book to library using audible cli and asin?
There is no command for this yet. But you can use the API with audible api -m put -b '{"asin": "ASIN_TO_ADD"}' -i 4 library/item
Hmm iis there any command to clean all library at once?
Do you mean remove all? Then no, there is not such command yet. But can be implemented.