eBook cli downloader
Go to file
Mattias Svensson 6d22194fb0 Embed book metadata into epub output (self-describing files)
grawlix wrote no metadata into the epub for EpubInParts sources (e.g. Nextory):
the ebooklib rebuild set no title/author/series, so the OPF held only a UUID.
SingleFile sources (e.g. Storytel) keep the publisher OPF, which has title and
author but no series. Either way a library manager can only fall back to the
filename.

Add Epub._embed_metadata(location, metadata): after the file is written, ADD any
missing dc:title/creator/language/publisher/date + calibre:series/series_index
from book.metadata to the OPF. It is add-only (never removes or rewrites existing
OPF elements, so publisher metadata, EPUB3 refines and comments stay intact),
respects the OPF's declared encoding, reads entries by ZipInfo, and swallows all
errors so it can never turn a successful download into a failure.

Supporting changes:
- Populate the Nextory Metadata with index (volume), language, publisher and
  release_date so those fields exist to embed and to fill output templates.
- str()-coerce metadata values when building the output path, so a numeric
  series index does not crash remove_unwanted_chars.
- Remove the stray exit() at the end of _download_epub_in_parts (also fixed in
  #27) — a prerequisite for the embed step to run for EpubInParts sources.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 19:48:58 +02:00
grawlix Embed book metadata into epub output (self-describing files) 2026-07-01 19:48:58 +02:00
.gitignore Add support for marvel unlimited 2023-05-14 17:35:25 +02:00
flake.lock Add nix flake 2025-12-27 14:12:18 +01:00
flake.nix Add nix flake 2025-12-27 14:12:18 +01:00
LICENSE Create LICENSE 2023-04-29 17:14:27 +02:00
pyproject.toml Fix Nextory: bump X-App-Version, null series, missing urllib3 dep (#25) 2026-06-03 07:50:17 +00:00
README.md Add storytel support (#13) 2024-04-02 15:18:45 +00:00
setup.py Add code 2023-04-06 21:38:19 +02:00

grawlix

GitHub release GitHub top language License Donate using Ko-Fi

CLI ebook downloader

Supported services

grawlix currently supports downloading from the following sources:

Installation

pip install grawlix

From repo (unstable)

git clone https://github.com/jo1gi/grawlix.git
cd grawlix
python3 setup.py install

Authentication

Authentication can either be done with login (username and password) or cookies. Not all sources support both methods.

Login

Some sources require authentication, which can be done either with cli arguments or a config file.

Cli example

grawlix --username "user@example.com" --password "SuperSecretPassword" <url>

Config file example

[sources.name]
username = "user@example.com"
password = "SuperSecretPassword"

Config file should be placed in ~/.config/grawlix/grawlix.toml

Cookies

Some sources can be authenticated with Netscape cookie files. I use this extension to export my cookies from my browser.

Cookies can be placed in current dir as cookies.txt or be given with the --cookie argument.

Download books

To download a book run:

grawlix [options] <book url>