simple cli to download e-books from o'reilly learning plattform to your filesystem as pdf
A fast and simple CLI shell script to download e-book as pdf from https://learning.oreilly.com/
Download the script and save it in the directory where you want to save the downloaded e-book.
Start your terminal shell and execute the following command:
bash oreilly-downloader.sh -b <book-number> -t <book-title>
book-number (-b): You can find the book number in the url as shown in the picture below.
book-title (-t): You can name the pdf as you want. The book title must be spelled without spaces. Like designing_react_hooks_the_right_way
You dont have to specify or provide a file extension
You have to options to provide credentials for o reilly learning plattform to the script.
brew install calibre
for further instructions or other OS
Calibre Homepage
Make sure to register and sign up for a account at O'Reilly Learning Website
You can create a test account and fully use this cli.
Note:
Please make sure to not violate any restrictions or rules from O'Reilly Learning Website
First, find a book in O'Reilly Learning. Here I picked the famous Art of Computer Programming
by Knuth,
you can find it at https://learning.oreilly.com/library/view/art-of-computer/9780321635754/.
Copy the ID of the book (in this case 9780321635754
)
And then run following command in the directory where you download the script
bash oreilly-downloader.sh -b `9780321635754` -t art-of-computer -f pdf || epub || both
only one argument is required to set data type
syntax | argument | explanation | example |
---|---|---|---|
book id |
-b |
the ID of the book | 9780321635754 |
title |
-t |
the title of the book - you can use every title you want. Please make sure to not use spaces | art-of-computer |
print-as |
-f |
what format you want the book: epub -> pdf -> both | art-of-computer |
A step by step series of examples that tell you how to get the script ready.
Be sure you have Docker installed and running
Be sure you have calibre installed and the cli
# test calibre cli with
ebook-convert --version
# shell output
ebook-convert (calibre 5.39.1)
#Created by: Kovid Goyal
Make sure you set-up your account at o'reilly. Then open user.conf.sample
file with text editor (vim, nano, code) and insert your username and password or:
echo "your-username" >> user.conf.sample
echo "your-password" >> user.conf.sample
Then move the file to data
directory. Please vaidate you have a directory called data or create a new one
mkdir -p data
mv user.conf.sample data/user.conf
bash oreilly-downloader.sh -b `9780321635754` -t art-of-computer -f pdf || epub || both