This script downloads an ebook from an online reader and creates an EPUB file for offline viewing.
Though this script can be used if you know the URL to a remote EPUB archive, it is specifically designed to handle finding EPUB URLs for the following sites:
Please open an issue to request support for other domains, or submit a PR!
Given a URL to a remote EPUB file, this script parses its content list and downloads all the necessary files to recreate the EPUB archive locally.
If a URL to an www.epub.pub or a www.readanybook.com book page is supplied, it can automatically resolve the EPUB's remote storage URL.
This script supports verbose output to help track the progress and identify issues during the download and creation process.
Works on Linux, MacOS and Windows.
bs4
lxml
tqdm
urllib3
Clone the repository or download the script file.
Install the required Python packages using pip:
pip install -r requirements.txt
To run the script, use the following command:
Copy code
python epub_downloader.py [book_url] [-v]
book_url
: The URL of the EPUB archive or to the book page on epub.pub or readanybook.com-v
, --verbose
: Enable verbose output (optional)The script handles downloading directly from the book page for the www.epub.pub and www.readanybook.com domains:
python epub_downloader.py https://www.epub.pub/book/it-by-stephen-king
python epub_downloader.py https://www.readanybook.com/ebook/it-book-565296
Or you can download from the epub.pub spread or continuous page (after clicking on one of the Read Online buttons):
python epub_downloader.py https://spread.epub.pub/epub/5a5827247412f4000781f18e
python epub_downloader.py https://continuous.epub.pub/epub/5a5827247412f4000781f18e
Or if you're into digging for the EPUB URL manually:
python epub_downloader.py https://asset.epub.pub/epub/it-by-stephen-king-1.epub