Comments (12)
Hi,
I try to find some informations about the asin B07231CR59 but google found nothing. What is this for a product and which content type? Is it a serie, a SinglePartBook, a MultiPartBook or something other?
Hint:
If you download a book with the licenserequest method, it downloads the book in aaxc format. This format can’t be encrypted at this moment (I think so)! Please read #3 for more informations how to download books in aax format.
Regards
from audible.
Thanks for the fast response! It is much appreciated!
The specific asin I provided is the asin of a child to the book. I also attempted with the book asin ('B07148GH11') and other books and always obtained the same error.
How do I determine if this is a single part book or a multipart book? Ideally, I would like 1 large file for the whole book instead of downloading it in several parts.
I also tried to follow the instructions in the post you shared and found that the method 'client._sign_request' does not exist. I haven't found where it might have been moved to.
from audible.
Which version of my audible app you use?
Can you try my download example at https://github.com/mkb79/Audible/blob/master/examples/download_books_aax.py
from audible.
I tried with the example you provided and I am receiving a 500 error on each calls to get the download link. I did make sure I specify a codec as available in the list of available codecs for each given book.
I'm using Audible Canada, could this be an issue?
I'm using the latest version published on Pypi
from audible.
Hmm, that sounds strange.
Can you make the following api call:
book = client.get(
"library/B07148GH11",
response_groups="product_desc, series, relationships"
)
print(book)
and send me the response. You can send me a mail to [email protected] instead to post the response content here.
from audible.
Can you try this code please (please set the correct settings to your auth file):
import pathlib
import shutil
import audible
import httpx
# get download link(s) for book
def _get_download_link(auth, asin, codec="LC_128_44100_stereo"):
# need at least v0.4.0dev
try:
content_url = (f"https://cde-ta-g7g.amazon.com/FionaCDEServiceEngine/"
f"FSDownloadContent")
params = {
'type': 'AUDI',
'currentTransportMethod': 'WIFI',
'key': asin,
'codec': codec
}
r = httpx.get(
url=content_url,
params=params,
allow_redirects=False,
auth=auth
)
# prepare link
# see https://github.com/mkb79/Audible/issues/3#issuecomment-518099852
link = r.headers['Location']
tld = auth.locale.domain
new_link = link.replace("cds.audible.com", f"cds.audible.{tld}")
return new_link
except Exception as e:
print(f"Error: {e}")
return
def download_file(url):
r = httpx.get(url)
try:
title = r.headers["Content-Disposition"].split("filename=")[1]
filename = pathlib.Path.cwd() / "audiobooks" / title
with open(filename, 'wb') as f:
shutil.copyfileobj(r.iter_raw, f)
return filename
except KeyError:
return "Nothing downloaded"
if __name__ == "__main__":
auth = audible.FileAuthenticator(
...
)
client = audible.Client(auth)
asin = "B07148GH11"
dl_link = _get_download_link(auth, asin)
print(dl_link)
if dl_link:
print(f"download link now: {dl_link}")
status = download_file(dl_link)
print(f"downloaded file: {status}")
from audible.
I still receive a 500 error with no details on the request
from audible.
Have you register a device and use sign request method or you use access token authentication? You can test this with print(auth.adp_token)
. If you get a not None response you use sign request method.
Can you try this code and send me the response via mail please?:
import audible
import httpx
auth = audible.FileAuthenticator(
...
)
client = audible.Client(auth)
asin = "B07148GH11"
codec="LC_128_44100_stereo"
content_url = (f"https://cde-ta-g7g.amazon.com/FionaCDEServiceEngine/"
f"FSDownloadContent")
params = {
'type': 'AUDI',
'currentTransportMethod': 'WIFI',
'key': asin,
'codec': codec
}
r = httpx.get(
url=content_url,
params=params,
allow_redirects=False,
auth=auth
)
print(r.headers)
from audible.
print(auth.adp_token) returns None. So I guess I am using the sign request method.
The code above returns the following:
Headers({'x-adp-host': 'H3K246P9RFUS2E', 'content-length': '87', 'date': 'Fri, 24 Jul 2020 15:30:13 GMT', 'connection': 'close', 'server': 'Amazon Web Server'})
from audible.
If you have no adp token in your auth file then you use access token auth mode. Access token is only valid for 60 minutes. So you have to authenticate again after that time.
Access token auth mode have more limitations if you make api calls. Maybe this is the problem. Can you use LoginAuthenticator with register option and save your auth data to file. Then try again the last code snippet.
from audible.
Well damn! That did the trick! I now have the "location" value in the returned header.
Thanks for the great support, I'm going to be closing this issue.
from audible.
That‘s great to hear!
I will adjust my download example to make sure adp_token is present in auth file.
from audible.
Related Issues (20)
- 错误提示 HOT 19
- Quality is set to `Extreme` even set to `high` HOT 1
- TEST: New device registration method HOT 4
- Extract Audible Bookmark Notes HOT 3
- Issue getting activation bytes from auth server HOT 9
- Switch to poetry, implement CI+CD, remove Python version <3.8
- Lift upper version restriction on `httpx`. HOT 3
- Is there any way to get a list of books in a series? HOT 1
- Amazon authentication code not handled properly HOT 2
- I need some help with metadata HOT 2
- Audible brazil HOT 11
- Captcha Login Fails 'KeyError' HOT 17
- OTP prompt for 2FA in JupyterLab HOT 4
- Building an external login URL HOT 9
- encryptedPwd HOT 5
- How does the BestSellers sort_by option in the APIs work? HOT 3
- Where does the file get stored with to_file() HOT 5
- Can't filter plus catalog books from 'catalog/products' HOT 9
- state token for library requests HOT 2
- response_callback no longer works properly with the endpoint: https://cde-ta-g7g.amazon.com/FionaCDEServiceEngine/sidecar HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from audible.