Skip to main content

orlydown

PyPI Python versions License

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.1

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.1
File Size Uploaded Provenance Actions
orlydown-0.1.1.tar.gz 6.1 kB Without provenance Details for orlydown-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 13.1 kB

Release files / orlydown-0.1.1.tar.gz

Download URL orlydown-0.1.1.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
50b87df4b56d1b2efeb03f80b5661ae4da118a0a468267fba858f06f8a7675cc
BLAKE2b-256 checksum
How to use checksums
f86cfe1b7464cc080f74c9441a67056162c10475961bc8f0185a50c4ac895b7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","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.1-py3-none-any.whl

Download URL orlydown-0.1.1-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52c499f0fb807fdd98c5aa118b5d2ff7caff978e1c5db26432297e2cd9a78ab2
BLAKE2b-256 checksum
How to use checksums
95f38a004df08d86ce7604554303ae5a492e4c826425d42d535539d6fcf72734
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","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.1

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