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

Able to download books manually, but tool downloads as 101kb web pages instead #192

Closed
jandubois opened this issue Feb 22, 2025 · 5 comments
Labels
bug Something isn't working

Comments

@jandubois
Copy link

The download works fine and extremely fast, just seconds (I only have 57 books). Somewhat surprisingly all books are the same size, around 101K with a .azw3 extension.

Loading them into Kindle Classic on macOS doesn't throw an error, but shows only empty pages.

Loading them into calibre throws an calibre.ebooks.mobi.MobiError: Unknown book type: b' TRANSIT' error.

Downloading a random book from the collection manually works and results in a 550K file with an .azw extension that can be loaded by both Kindle Classic and calibre.

@treetrum
Copy link
Owner

Yeah, the fact that they're all the same size indicates that these are downloading an error web page instead of the books themselves. Just want to confirm that you've looked through the prerequisites and troubleshooting sections of the readme before I start troubleshooting even further?

The usual culprits have been not setting the correct amazon baseUrl (or forgetting www.), and selecting a kindle from the list that doesn't allow downloads.

If you can download manually, this tool should work for you, it will just be a matter of setting things up correctly.

@jandubois
Copy link
Author

Yeah, the fact that they're all the same size indicates that these are downloading an error web page instead of the books themselves.

Yes, the files indeed contain HTML that looks like an Amazon auth page.

Just want to confirm that you've looked through the prerequisites and troubleshooting sections of the readme before I start troubleshooting even further?

I did, and everything seems to be working fine, except for the file content. I get an error when I specify an expired OTP, but when I specify a valid one, I get the list of all the book titles correctly, and it claims to be downloading them without any errors:

$  AMAZON_USER=XXX PASSWORD=XXX OTP=XXX bun run start --baseUrl=https://www.amazon.com
$ bun run src/index.ts "--baseUrl=https://www.amazon.com"
Getting credentials
Got credentials
Filling username
Filling password
Filling OTP
Got auth
Got device Jan's Kindle XXX
Found 57 books in total

Processing batch 1/6 (Books 1-10)
...
Downloading complete. You can find your books in the 'downloads' folder.

The usual culprits have been not setting the correct amazon baseUrl (or forgetting www.), and selecting a kindle from the list that doesn't allow downloads.

If you can download manually, this tool should work for you, it will just be a matter of setting things up correctly.

I was hoping you might have an idea right away about what the issue might be, but if you don't, then I don't want to waste your time. I will just download the books manually given that I only have 57, and that the tool will stop working in a week anyways.

Thank you for making the tool available!

@treetrum
Copy link
Owner

Damn, unfortunately there's nothing else off the top of my head. You seem to be on the happy path right up until the downloads aren't working 😔 Will leave the issue open in case anyone else has any advice but I've got nothing else to suggest for the moment.

@treetrum treetrum changed the title Download seems fine but files are not usable Able to download books manually, but tool downloads as 101kb web pages instead Feb 22, 2025
@treetrum treetrum added the bug Something isn't working label Feb 22, 2025
@jandubois
Copy link
Author

Looks like I was confused because originally there was no Kindle store for Canada. I can download the books via https://www.amazon.ca. So it seems like the contents was transferred at some time. I actually had 106 books there, which included the 57 from the US store.

Sorry for not checking this first (I thought the fact that I could manually download from www.amazon.com meant that the tool should have worked too!

@treetrum
Copy link
Owner

Very interesting! Thanks for the update!

I will add this to readme for something else to check in case anyone runs into similar issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants