Skip to main content

hanser-py-library

This tool downloads a book from https://www.hanser-elibrary.com saves them to a PDF File called -.pdf. If the book's title contains characters that aren't allowed in a filename it will be saved as -.pdf. If files with that name already exist the number of existing files will be appended to the chosen file name like this (#).

By default the merged book will be saved in the directory from which the program was called, but you can provide a custom output directory.

If a complete book pdf is available, the tool will preferably download that file, otherwise it will download each individual chapter and merge them into a single file before saving. Unfortunately, this leads to links within the merged book (e.g. chapter references) being broken.

The tool will check whether you are authorized to access the book before downloading anything. If you are unauthorized, the book will be skipped.

Installation

Installing through pipx isolates packages in their own environment and exposes their entrypoints via PATH.

pipx install hanser-py-library

Alternatively install regularly via pip:

pip install hanser-py-library

Usage

usage: hanser [-h] [--isbn [[...]]] [-o PATH] [-f] [URL [URL ...]]

You must provide at least one valid URL or ISBN. The program will attempt to fix URLs with missing schemes by defaulting to "https://". Each URL needs to end with a valid ISBN-10 or -13 number. Valid URL formats include:

Referencing by ISBN-10 or ISBN-13

https://www.hanser-elibrary.com/isbn/{ISBN}
https://hanser-elibrary.com/isbn/{ISBN}
www.hanser-elibrary.com/isbn/{ISBN}
hanser-elibrary.com/isbn/{ISBN}

Referencing by DOI and ISBN-13

https://www.hanser-elibrary.com/doi/book/{DOI}/{ISBN}
https://hanser-elibrary.com/doi/book/{DOI}/{ISBN}
www.hanser-elibrary.com/doi/book/{DOI}/{ISBN}
hanser-elibrary.com/doi/book/{DOI}/{ISBN}

Options

Short Long Description
-h --help Show help message and exit.
-o --out Path to output directory. Relative and abstract paths supported. Cannot point towards file.
Paths starting with '~' it will be expanded from the user's home directory
Path must point towards existing directory unless -f is set.
-f --force If set the output directory and every directory on the way will be forcibly created.
Exits if the directory cannot be created.
--isbn ISBNs of books to download. Can be either ISBN-10 or 13.
If you want to provide both ISBNs and URLs, provide URLs first like this:
hanser [URL [URL ...]] [--isbn [[...]]]
If ISBN(s) and URL(s) are provided, URL books will be downloaded before ISBN books.

Examples

Saving in current working directory

hanser https://www.hanser-elibrary.com/isbn/9783446450776

hanser https://www.hanser-elibrary.com/doi/book/10.3139/9783446450776

hanser --isbn 9783446450776

Saving in a directory that exists

hanser -o path/to/dir hanser-elibrary.com/isbn/9783446450776

Saving in a directory that may or may not exist

hanser -o path/to/dir -f hanser-elibrary.com/isbn/9783446450523

Encountered a Bug?

Feel free to open an issue if you encountered bugs or have other ideas that aren't yet listed in the backlog.

Metadata

Release files for hanser-py-library 0.3.4

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

Source distribution (sdist)

Source distribution for hanser-py-library 0.3.4
File Size Uploaded
hanser-py-library-0.3.4.tar.gz 24.7 kB Details

Release files / hanser-py-library-0.3.4.tar.gz

Download URL hanser-py-library-0.3.4.tar.gz
Size 24.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c304bb1540044839f8472f90f4d16a3d949c2dae846149a300f1c1b3e4c772fa
BLAKE2b-256 checksum
How to use checksums
b36f426324170398c3a209d9b583f936f3e4bef6cf2c3f04f386d58bbb9f94b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

Release history Release notifications | RSS feed

This release

0.3.4 This release

1 release file

0.3.2

1 release file

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