Open nullbasis opened 3 years ago
Honestly, if it would help, I'd be willing to buy and gift some cheap book to someone who could do the dev work.
I use Audible a good amount. I'll take a shot at it.
Maybe interesting here: Some people who know how to find a specific network request with devTools downloaded stuff with youtube-dl.
https://forum.videohelp.com/threads/396514-Downloading-audio-from-stories-audible-com
They wrote that the links to audio files expire qickly (~60 seconds).
I did not have any luck with that, because i had an Error 403 no matter how fast i did it.
I also keep getting 403 errors with the method in that forum post. Amazon must have "fixed" things since then.
89z, an API would be great!
This could probable help:
For me, clicking "Download" on the Audible site is basically useless unless my internet connection is super stable. Since I'm currently out traveling in Asia it never is, and thus I have been having a really hard time getting my books. I manage to use curl
with the continue-flag to resume my transfer, and trying repeatedly seems to make progress!
curl \
-C - \
-o my-book.aax \
"https://cds.audible.com/download?user_id=$USERID&product_id=$SKU&codec=LC_128_44100_Stereo&awtype=AAX&cust_id=$USERID" \
--header 'User-Agent: Audible ADM 6.6.0.19;Windows Vista Build 9200'
I managed to find my $USERID
by having the developer console open whilst trying to download the file from the Audible site, and the $SKU
can be found in the source for the page of the book e.g:
I just published a little tool that downloads, and most importantly, retries on each lost connection 🎉
The tool implements https://github.com/ytdl-org/youtube-dl/issues/28317#issuecomment-1471274712.
As this solution is to populate
https://cds.audible.com/download?user_id={USERID}&product_id={SKU}&codec=LC_128_44100_Stereo&awtype=AAX&cust_id={USERID}
an extractor has to find USERID
and SKU
. The regional page https://www.audible.co.uk/pd/The-Invasion-Audiobook/1338641158, non-JS, not logged in, has the SKU
value in a JS assignment matching "sku": "(.+)"
.
Possibly if logged-in cookies were sent the .member
of the JS object would also be set with the USERID
value.
For a URL like https://www.audible.com/webplayer?asin=1338641158, the SKU
isn't available: perhaps rewrite the URL using the regional domain: apparently even this works:
https://www.audible.co.uk/pd/whatever-Audiobook/1338641158
this appears to download AAX files, which are encrypted:
https://wikipedia.org/wiki/Audible_(service)#Quality
if thats the case, I believe that is explicitly an anti-feature of YouTube-DL. @LinusU, do you have some reason to believe these are unencrypted files?
@4cq2 yes, they are encrypted. I should probably say that I just threw this tool together quickly to solve my particular problem right now: I can't download this specific audiobook on the internet connection I'm on right now.
It's clunky to use for sure since you need to know your customer_id, and the sku of the book.
In order to actually listen to the book, I'm using the instructions here: https://gist.github.com/r15ch13/0c548be006431607bf1eaecefdc0591a?permalink_comment_id=2800421#gistcomment-2800421
I once extracted my activation bytes from a Windows computer and have saved it in 1Password, so for me personally this is really easy.
It would be great with a PR to this repo that does all of the things: 1) variable extraction from url + login or cookies, 2) download the AAX file, and finally 3) decrypt it using ffmpeg. Ultimately, I only had an hour to spare on this, and I like Rust very much, so I did a separat tool that only solved my problem...
Possibly if logged-in cookies were sent the .member of the JS object would also be set with the USERID value.
@dirkf this is very interesting! Unfortunately, it doesn't seem to work for me though, member
is an empty object in the source served to me when logged in. Maybe this has something to do with my membership not being active though 🤔 (that is, I'm not currently on an active plan)
(e.g. https://www.audible.com/pd/The-Hobbit-Dramatised-Audiobook/B002VA91WK)
@LinusU decrypting media is typically an anti-feature of YouTube-DL. which means that any issues or pull requests discussing that are usually closed on those grounds. The line is somewhat blurry, as stuff like Widevine is explicitly not allowed, while other stuff like HLSe is allowed. this seems to pull a static key from the registry, which seems like it might be OK, in regards to the nebulous YouTube-DL rules.
YouTube-DL already can accept an argument that gets passed to FFmpeg, so that would apply here with -activation_bytes
. I dont think it should be YouTube-DL job to go digging into a users registry, just like I dont think it should be YouTube-DL job to go digging into a users cookies, but I guess that ship has sailed, so who knows. I will be interested to see how a maintainer views this issue.
Checklist
Example URLs
Description
Username and password would be required to download books. Since Audible only supports listening to books in the browser or in an app, it would be incredible if yt-dl could download one's purchases.
I'm not sure which of the above example links would be better as input. The latter is the page where the book plays directly, but the former is more obviously accessible to the average user.