Download O’Reilly Media EPUB books with SSO Login
If you have an O’Reilly Media Account, you may have noticed that - unfortunately - the platform doesn’t provide an easy way to download EPUB files for offline reading on your e-reader. While O’Reilly offers a web-based reader and mobile apps, sometimes you just want to read your books offline or on a dedicated e-reader, like a Kindle or Kobo.
This project on GitHub provides a simple Python script on a Docker container that allows you to download your O’Reilly Media EPUB books with a single sign-on (SSO) login. This way, you can easily transfer your books to your e-reader or mobile device for offline reading.
How to Use the O’Reilly Media EPUB Downloader with SSO⌗
If your account makes use of a Single Sign-On (SSO) provider, you can still use this script by providing your SSO login credentials. The script will handle the authentication process and download the EPUB files for you.
- Login as usual to https://learning.oreilly.com/
- Open the developer tools with F12
- Enter the command in the console:
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;}, {})))
- Paste the copied content into a file,
/path/to/cookies.json
- Run the following command to download the EPUB files:
(cat /path/to/cookies.json | docker run -i kirinnee/orly:latest sso <book id>) > "/path/to/book.epub"
where <book id>
is the ID of the book you want to download. You can find this ID in the URL of the book’s page on the O’Reilly platform.
I use this script to download my O’Reilly books for offline reading on a local folder synced with my Nextcloud instance.
Finally, using nextcloud-kobo, I sync the same folder into my Kobo e-reader. It’s a great and straightforward way to enjoy your technical books on your favorite e-reader without being tied to a web browser or mobile app on a tablet or smartphone.