Learn how to download books from the O'Reilly Learning platform with your paid subscription.

How to download books (ePub format) from the O'Reilly Learning platform (safari books)

I'm always looking new material to learn from, just like those +800 courses on my Udemy account, that maybe I will never finish ... but that's another story, I'd like to do the same with the famous books of Programming that you can find on the O'Reilly platform (I mean, reading them, not simply storing them).

You can access the O'Reilly Platform as an individual for $49 USD/month or $499/year. For sure, if you think that spending $49 dollars a month won't hurt you, it's recommendable to pay the subscribtion on the platform, considering the prices of buying every single book that you're interested on and assuming that you will read them, the fee that you pay for the online platform is really small and quite fair. However, as someone that lives in a third-world country (Colombia), $49 bucks right now are almost a quarter (1/4) of the minimum wage here in Colombia, so you know, I'd rather eat (now consider how expensive would it be to buy physical or digital books of similar prices). I would only be able to pay that for a couple of months, not the whole year, just as many other people of my country (and of course I'm not talking only about Colombia).

That's why I want to share with you, two useful methods to access most of the content that you can obtain while paying a single subscription of a month.

Important note: I'm not promoting something illegal though, do not get me wrong, to follow this tutorial you will need obligatorily:

  • An active O'Rilley Learning subscription of at least a month (you will invest $49 USD if you don't have a subscription already). In my case, I have a subscription thanks to my University, so I'm paying for it indirectly.
  • The books will be downloaded in the .epub format, so you need an EPub reader software installed on your computer. I use the Icecream Ebook Reader.

A. Using a Browser Extension (My O'Reilly Downloader) [Easier to use, for regular users]

My O'Reilly Downloader is a web browser extension available for Google Chrome and an add-on for Firefox that allows you to download with a simple click any book from the O'Reilly platform in .epub format with a single click. This option is the go-to if you don't have programming knowledge, it is quite straightforward, install the extension and click on a single button to obtain the book.

All you need to do is to install the extension in your browser, once you install it through the official store, search for any book that you want to download on the O'Reilly platform. Once you have it, on the right menu of the page of the book, you will find a tiny O'Reilly icon with a green icon over it (get ebook):

Download Button O'Reilly

Just press it and wait until the extension prepares the EPub of the selected book. Once it processes all of the batches, a message that states that the "ePub download has been completed" will appear and the download will be triggered in your browser (book.epub):

O'Reilly EPub Download

You can open and read the file with any regular EBook reader.

B. Using a Docker container [For programmers]

Now if you're into programming just like me, there's a way to do this through the command line to automatize this project with code if you want to. There's an useful project namely O'Reilly Downloader whose code can be found at GitHub here, and it's basically a CLI tool that wraps the Safaribooks project on Docker.

You will need Docker installed in your computer to do it this way.

B.1. Accessing with your credentials

Downloading a book using this approach is quite easy, you only need to run the following command replacing the following parameters:

  • <id of the book>: the ID of the book that you want to download. For example if the URL of the book is https://learning.oreilly.com/library/view/magento-2/9781788298025/, the id would be 9781788298025.
  • <email> and <password>: use your own credentials to log in to O'Reilly's Platform.
  • <BookName.epub>:  define the name of the output file.
(docker run kirinnee/orly:latest login <id of the book> <email>:<password>) > "<BookName.epub>"

The command with some real parameters would look like this:

(docker run kirinnee/orly:latest login 9781788298025 [email protected]:12345) > "MyBook.epub"

Wait until the command finishes and you will have the file of the book.

B.2. Accessing through a SSO Login

If your O'Reilly account, just like in my case, doesn't have a password itself but it uses SSO (Single Sign On) because I get access through my University account, then you need to follow some extra steps to get it working. The first thing you need to do is to log in to the platform with your account, then go to your Profile (https://learning.oreilly.com/profile/).

In this page, we need to obtain the cookie of the browser in JSON format. The easiest way to do this is running the following script that will extract the cookie in the required format and will copy it into your clipboard. To run it press F12 in your browser, go to the console tab and paste the following code:

copy(JSON.stringify(document.cookie.split(';').map(c => c.split('=')).map(i => [i[0].trim(), i[1].trim()]).reduce((r, i) => {
    r[i[0]] = i[1];
    return r;
}, {})))

This will automatically copy the cookie in JSON format to your clipboard, now you need to paste its content in a new JSON file. Create the cookies.json file in your computer, paste the content that you have in the clipboard and save changes.

Note: you have do this everytime you want to download a book because the cookie needs to be updated with your current session.

Then, simply run the following command replacing:

  • <path/to/cookies.json>: the absolute or relative path to the cookies.json file created previously.
  • <id of the book>: the ID of the book that you want to download. For example if the URL of the book is https://learning.oreilly.com/library/view/magento-2/9781788298025/, the id would be 9781788298025.
  • <BookName.epub>:  define the name of the output file.
(cat </path/to/cookies.json> | docker run -i kirinnee/orly:latest sso <id of the book>) > "<BookName.epub>"

The command with some real parameters would look like this:

(cat .\cookies.json | docker run -i kirinnee/orly:latest sso 9781788298025) > "magento2.epub"

And that's it:

Download O'Reilly Book Docker CLI

Final thoughts

In my case, I started downloading 2 books Java: A Beginner's Guide, Eighth Edition 8th Edition, Kindle Edition, and Official Google Cloud Certified Associate Cloud Engineer Study Guide 1st Edition, Kindle Edition , both digital versions cost USD $47.48 on Amazon. so if you pay a monthly subscription, you already won:

Ebook Reader O'Reilly

I downloaded as well other books that I think i'll be reading soon due to my current job. Don't forget that the goal of having access to this kind of book, is to acquire knowledge that will allow you to earn money to pay for this kind of content, for sure buying the content directly from their creators is the best way to do it and support them, but until you can do that, this trick will help you to get on track.


Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Sponsors