Hello there,
I started working with this repo a few hours ago because I do like the idea of archiving audiobooks.
This is a plus catalog audiobook so anyone with the subscription can help me with it.
ASIN - 1665074620
Title - What Addicts Know
I am using Google Colab for this as I like to try new things there and then implement the rest on my server.
I have a few questions about the usage but before that, I want to know how to download the audiobooks. I don't care about the format (.aax or .aacx) because I can decode either. Which link do I download?
The following is my code to get the download URL:
body = {
"supported_drm_types" : [
"Mpeg",
"Adrm"
],
"quality" : "High",
"consumption_type" : "Download"
}
token = client.post("1.0/content/1665074620/licenserequest", body)
print(json.dumps(token, indent=3, sort_keys=True))
OUTPUT:
{
"content_license": {
"access_expiry_date": "2024-12-31T12:00:00Z",
"acr": "CXXXXXX",
"allowed_users": [
"amzn1.account.XXXXXXXXXXXXXXXXXXXXXXXXX"
],
"asin": "1665074620",
"content_metadata": {
"content_url": {
"offline_url": "https://dze5l2jxnquy5.cloudfront.net/bk_blak_016548it/28335321/aax/XXXX....XXXX"
}
},
"drm_type": "Adrm",
"license_id": "XXXXXXXXXXXXXXXXXXXXXXXX",
"license_response": "y/XXXXXX.....XXXXX",
"message": "Customer [XXXXXXXXXXXXXXX] has rights to asin [1665074620] for AYCL",
"refresh_date": "2022-03-18T06:28:07Z",
"removal_date": "2022-04-27T06:28:07Z",
"request_id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"requires_ad_supported_playback": false,
"status_code": "Granted",
"voucher_id": "cdn:XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
},
"response_groups": [
"always-returned"
]
}
### When I click the offline_url, I get this following error:
##
At first I thought that my macBook and the Colab instance have different IP Addresses and thats why I can't download it. Then I tried downloading it directly on the colab instance but it still wouldn't download.
I don't understand what I am doing wrong here. I read the closed thread for downloading files but the first post is from back in 2019 and it doesn't work.
The other question I have is about only getting the Audible Plus Catalog. I see the plan for it is named "Audible-AYCL" which is not included in plans[]. I created a function for this and I got around it but it would be nice if it was updated.
### My whole code:
!mkdir /content/audible
import audible, urllib, cv2, json
from google.colab.patches import cv2_imshow (I am running this in google colab)
DIR_PATH = "/content/audible"
email = "xx"
pasword = "xx"
country = "xx"
def cb(captcha_url):
urllib.request.urlretrieve(captcha_url, "/content/audible/captcha.jpg")
image = cv2.imread('/content/audible/captcha.jpg')
cv2_imshow(image)
print(captcha_url)
answer = input("Answer for CAPTCHA: ")
answer = str(answer).strip().lower()
return answer
!rm /content/captcha.jpg
auth = audible.Authenticator.from_login(
email,
pasword,
locale = country,
with_username=False,
captcha_callback=cb
)
auth.to_file(DIR_PATH+country)
auth = audible.Authenticator.from_file(DIR_PATH+country)
client = audible.Client(auth)
body = {
"supported_drm_types" : [
"Mpeg",
"Adrm"
],
"quality" : "High",
"consumption_type" : "Download"
}
token = client.post("1.0/content/1665074620/licenserequest", body)
print(json.dumps(token, indent=3, sort_keys=True))
Looking forward to solving this problem. Will update if I find something new.