Skip to content

sicoda/Kindle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Gutenberg-to-Kindle

A Python script that automatically downloads the most popular public-domain books from Project Gutenberg and sends them directly to your Kindle.

Project Gutenberg has over 75,000 free public domain ebooks to pick from! Instead of dowloading individual ebook files and sending them one by one to your kindle, this script automates the entire process. The script retrieves books based on their popularity ranking, downloads the EPUB files, and delivers them directly to your Kindle using Amazon's Send-to-Kindle service.

I originally wrote this for my mom so she could load her Kindle with a large library of free books before the device became obsolete. After running the script, she ended up with hundreds of classics stored on her Kindle and ready to read offline!

Tools

  • Gutendex API to safely retrieve Project Gutenberg's catalog sorted by popularity.
  • Project Gutenberg EPUB downloads for the actual book files.
  • Gmail SMTP to send EPUB attachments.
  • Amazon Send-to-Kindle to deliver books directly to your device.

Functionality

  1. Queries the Gutendex API for the requested ranking range.
  2. Downloads EPUB versions of each book.
  3. Emails each book to your Kindle.
  4. Deletes the local EPUB file after successful delivery.
  5. Waits between emails to avoid rate limiting.

Installation

  1. Clone the repository:

    git clone [https://github.com/sicoda/gutenberg-to-kindle.git](https://github.com/sicoda/gutenberg-to-kindle.git)
    cd gutenberg-to-kindle
  2. Install dependencies: This script requires Python 3.8+ and a few external libraries:

    pip install requests python-dotenv
    

Configuration

Before running the script, configure your Kindle and email settings.

1. Add Your Email to Amazon's Approved Sender List

Amazon only accepts documents sent from approved email addresses.

  1. Go to Amazon's Manage Your Content and Devices page.
  2. Open the Preferences tab.
  3. Scroll to Approved Personal Document Email List.
  4. Add the email address you will use to send books.
  5. Update the script: SENDER_EMAIL = "your_email@gmail.com"

2. Find Your Kindle Email Address

While still in Manage Your Content and Devices, locate:

  1. Send-to-Kindle Email Settings
  2. Your Kindle address will look something like: username_######@kindle.com
  3. Update the script: KINDLE_EMAIL = "your_kindle_email@kindle.com"

3. Create a Gmail App Password

Google no longer allows normal account passwords for SMTP applications. Instead, create an App Password.

  1. Open your Google Account settings.
  2. Enable 2-Step Verification if it is not already enabled.
  3. Navigate to Security > App Passwords.
  4. Generate a new App Password for Mail.
  5. Copy the generated password.
  6. Update the script: SENDER_PASSWORD = "your_app_password"

Note: This is an App Password, not your regular Google account password. Keep this secure!

Running the Script

Edit the following values to specify the number of books to download (by popularity ranking). The script below is set to download the first 100 most popular books:

START_RANK = 1
END_RANK = 101

Note: Gmail caps SMTP emails at 500 per day. Do not set the range to anything higher than 500 at a time.

Run by entering python gutenberg_to_kindle.py into your terminal.

Disclaimer

This project is intended for personal use with legally available public-domain books from Project Gutenberg. Please respect the terms of use of Project Gutenberg, Amazon, and your email provider.

About

Python script to automatically download the most popular public domain books from Project Gutenberg

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages