Skip to main content

orlydown

O'Reilly provides all of their books in epub format, but only through their own reader. orlydown downloads the individual files and assembles them back into a complete epub, so you can read your books in any reader (Apple Books, Calibre, KOReader, …), e.g. for accessibility reasons.

Before using it, please read the O'Reilly Terms of Service.

This is a fork of xi/oreilly-downloader that fixes epubs which didn't render properly:

  • Stylesheets are linked from every chapter, so books keep their formatting and fonts.
  • Images and links work in books that keep chapters in a subdirectory (e.g. Text/, Images/).
  • Books whose package file isn't called content.opf (e.g. Springer titles) open correctly.
  • SVG covers are scaled to fit the page instead of being cropped.
  • A --title option names the epub after the book instead of its ID.
  • A --require-auth option stops straight away if your token doesn't work.
  • No dependencies: it only uses the Python standard library.

Installation

You need Python 3.9 or newer. The easiest way to install orlydown is with pipx, which puts it in its own environment and adds the orlydown command to your PATH:

pipx install orlydown

Upgrade later with pipx upgrade orlydown. To run it once without installing anything:

pipx run orlydown 9781491958698 --jwt 'XYZ'

With uv, the equivalents are uv tool install orlydown and uvx orlydown ….

Since there are no dependencies, you can also download oreilly_downloader.py and run it directly with python3 oreilly_downloader.py ….

Getting your JWT

Without a valid JWT every chapter is cut short. To get one:

  1. Log in to https://learning.oreilly.com in your browser.
  2. Open the developer tools and find the cookies for learning.oreilly.com.
  3. Copy the value of the orm-jwt cookie.

If orlydown reports Authentication failed, log in again and copy a fresh cookie.

Usage

Find the book ID in the book's URL, e.g. 9781491958698 in https://learning.oreilly.com/library/view/test-driven-development-with/9781491958698/.

$ orlydown 9781491958698 --jwt 'XYZ'
Authentication successful.
fetching https://learning.oreilly.com/api/v2/epubs/urn:orm:book:9781491958698/files/
…
created 9781491958698.epub

To name the file after the book instead of its ID, add --title:

$ orlydown 9781491958698 --jwt 'XYZ' --title
…
created Test-Driven Development with Python, 2nd Edition.epub

A : in the title becomes - and a / becomes -, so the name is safe to use as a filename.

By default, a missing or rejected token only prints a warning and the download carries on with truncated chapters. Add --require-auth to stop with an error instead, which is useful in scripts:

$ orlydown 9781491958698 --jwt 'expired' --require-auth
Authentication failed.
$ echo $?
1

Options

Option Description
--jwt TOKEN Your orm-jwt cookie. Without it, chapters are cut short.
--require-auth Exit with an error if no JWT is given or it isn't accepted.
--title Name the epub after the book title instead of its ID.
--delay N Wait N seconds between batches of downloads. Try 5 if you get 403 errors.

Development

The project is managed with uv:

uv run orlydown --help
uv build

Releasing

Pushing a v* tag publishes that version to PyPI. The version is the tag name without the v, so v1.0.0 publishes 1.0.0:

git tag v1.0.0
git push origin v1.0.0

Publishing uses PyPI trusted publishing, so no API token is stored in the repository. It needs a one-time setup: on PyPI, add a trusted publisher for project orlydown with owner ashleyconnor, repository orlydown, workflow publish.yml and environment pypi.

Similar projects

License

MIT, see LICENSE.

Metadata

Release files for orlydown 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for orlydown 0.1.0
File Size Uploaded Provenance Actions
orlydown-0.1.0.tar.gz 6.0 kB Without provenance Details for orlydown-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for orlydown 0.1.0
File Interpreter ABI Platform Actions
orlydown-0.1.0-py3-none-any.whl Python 3 none any Details for orlydown-0.1.0-py3-none-any.whl

Total release size: 12.8 kB

Release files / orlydown-0.1.0.tar.gz

Download URL orlydown-0.1.0.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
69d410493832d260269982071e959bc21164a24d98a51a5572f0214e93023c07
BLAKE2b-256 checksum
How to use checksums
8972108476c371e6be96fa08c18ad23531df3ceed89fca77067e13c982a28a73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / orlydown-0.1.0-py3-none-any.whl

Download URL orlydown-0.1.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53fed21ede7de026ec8edd4cdd83e2f19cfbdf25487c6e842340057680b65353
BLAKE2b-256 checksum
How to use checksums
cf92396941ba33583a16f9af250f12357702c7d819ee531381e20a62ab4ba8a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for orlydown 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page