View Single Post
Old 02-23-2025, 09:39 AM   #532
Timboli
Sharpest Tool On Shelf
Timboli ought to be getting tired of karma fortunes by now.Timboli ought to be getting tired of karma fortunes by now.Timboli ought to be getting tired of karma fortunes by now.Timboli ought to be getting tired of karma fortunes by now.Timboli ought to be getting tired of karma fortunes by now.Timboli ought to be getting tired of karma fortunes by now.Timboli ought to be getting tired of karma fortunes by now.Timboli ought to be getting tired of karma fortunes by now.Timboli ought to be getting tired of karma fortunes by now.Timboli ought to be getting tired of karma fortunes by now.Timboli ought to be getting tired of karma fortunes by now.
 
Timboli's Avatar
 
Posts: 661
Karma: 2587836
Join Date: Feb 2009
Location: Downunda
Device: Kindles, Kobo & Samsung Tablet
As I mentioned in an earlier post, I created a program that assists with the JavaScript program that has been posted back on Page 6. My program gives full automation, so progresses through all your pages of ebooks, saving each one.

Alas I was late to the party, so sorry about the late provision of this.

My 'KindEbook Downloader Assistant' program is a companion to the 'download-all-kindle-books.js' script.

The program makes downloading of your Amazon ebooks a fully automated process.

There are several requirements.

(1) Windows OS is required.
(2) The 'download-all-kindle-books.js' script is required, and needs to be slightly modified. See here for the detail and link.
(3) Your browser window should be full screen. This simplifies setting up the mouse fallback option.
(4) Your browser needs to be set to query mode for saving files. This ensures my program does the saving, not the JS script.
(5) Your browser's default save location (path) needs to be set, and then entered into the input provided.
(6) Do not use your PC for anything else while my program is running. Perhaps disable any background process that might interfere.
(7) You probably need to also update the following line in the JS file.
await new Promise(resolve => setTimeout(resolve, 5000));
to at least -
await new Promise(resolve => setTimeout(resolve, 10000));
I have mine set at -
await new Promise(resolve => setTimeout(resolve, 14000));
which was the value in the original version of the script.


ADVICE
My program has only been tested in Windows 7 with the Brave (Chrome clone) browser.
The default delay values (delay, sleep, wait) reflect the use of a low power PC. They can possibly be reduced if using a much better PC, especially the 'Web Page Load Delay', which can probably be reduced to 30 seconds instead of 60.

I cannot advise how my program will work with a different version Windows OS or different browser. It should work with all Chrome variants though.

A line of code needs to be added (inserted) to the 'download-all-kindle-books.js' script.

button.innerText = 'Trigger Download';
button.accessKey = 'b';
button.style.position = 'fixed';

That second line, adds a hotkey (ALT+B) for the green JavaScript button (Trigger Download).
That hotkey is used by my program to click the JavaScript button as required.IMPORTANT - Sometimes that hotkey fails, at least for me. So there is a fallback, using your mouse, which moves until centered over the green JavaScript button and then clicks it. You need to set this during the first startup of my program.

The browser's default save location (path), is key to a few things. It is required for record keeping and easier result checking. Part of that, is creating folders based on page numbers, and relocating the downloaded ebooks to that folder when a page has finished being processed. So generally each page folder should contain 25 downloaded ebooks.

Exceptions to the 25 downloaded ebooks, are ebooks that are a Sample ebook or a magazine or any format that requires a Kindle device you don't have registered with Amazon. In fact, a magazine can halt the download process for a page, due to an error dialog being left open. With that last scenario, you will need to manually download any ebooks that are after a magazine ebook.

The timing of various elements is important, hence the various delays.

USAGE
Start the program, and respond to dialogs and inputs. I recommend going with defaults to start off with.
Don't click OK on the final dialog, until the desired Amazon ebook page is loaded, and you have clicked that green (Trigger Download) JavaScript button, after which you immediately click the OK button.

Pages are processed from high number to low number. You can set the start page number and the stop page number. Both those pages are processed in the session. If you are wanting every page in your Kindle library, start with the oldest page (highest number).

After the last ebook download for a page, there will be a delay, as the program ensures that the page has been fully dealt with. Then there will be another delay, as the next web page (if any) loads. Then the program will attempt to use the hotkey to start that next page being processed. If the hotkey fails, there will be another delay to ensure that is the case, then the fallback mouse option will be used, to click that green (Trigger Download) JavaScript button. NOTE - You don't really see anything happening during the delays.

It is recommended to just let things run and not interact with timed dialogs unless you need to. Essentially the only need to, would be to cancel (stop) the program, which is done using the CANCEL button on that final dialog. You get that opportunity after every page has been processed, for the period of the delay shown on the dialog.

FURTHER INFO
On average for me, it took 490 secs for a page, so roughly 8 to 10 mins.
On a better PC you can probably halve that.
A brief splash screen shows you the download count per page, after each download.
Before opening the next page tab, the previous one is closed, using the regular hotkey for that (at least in Chrome).
My program opens each new page with your default web browser.

DOWNLOAD
KindEbook Downloader Assistant v1-2.zip

This is a Rebrandly link for a download from MEGA.
The zip file contains the EXE and the AU3 source files, plus the above instructions in a text file.

You may need to give an exclusion in your AV program for my program. If unsure about that, just upload to VirusTotal to have it checked properly.

NOTE
Even though I have tested this program significantly, and managed to download almost 200 pages in a single run over many hours, it is still a quick and dirty program, mostly because it is a one time use, and didn't warrant me spending too much time on it. Normally I would have developed a GUI etc. So there are no guarantees, and any risks are all your own.

Best of luck and enjoy ... I hope it helps!

P.S. For one reason or another, an ebook download fails or is skipped. Those will have to be manually dealt with, which is not too difficult, due to the Log.txt file results and the number of files in each page folder, along with their file names.

Last edited by Timboli; 02-23-2025 at 12:08 PM. Reason: corrections etc
Timboli is offline   Reply With Quote