Metadata-Version: 2.4
Name: paraninfodl
Version: 1.1.0
Summary: Download ebooks from ebooks.paraninfo.es as PDF
License-Expression: MIT
Project-URL: Homepage, https://github.com/El-Mundos/paraninfodl
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: playwright>=1.40.0
Requires-Dist: cryptography>=41.0.0
Requires-Dist: img2pdf>=0.4.4
Requires-Dist: pypdf>=4.0.0
Requires-Dist: reportlab>=4.0.0
Requires-Dist: Pillow>=10.0.0
Requires-Dist: requests>=2.31.0
Requires-Dist: tomli>=2.0; python_version < "3.11"

# paraninfodl

Download ebooks from [ebooks.paraninfo.es](https://ebooks.paraninfo.es) as PDF. Chromium is installed automatically on first run.

## Installation

### pipx (recommended)

```bash
pipx install git+https://github.com/El-Mundos/paraninfodl
```

### uv

```bash
uv tool install git+https://github.com/El-Mundos/paraninfodl
```

### pip

```bash
pip install git+https://github.com/El-Mundos/paraninfodl
```

### Arch Linux (AUR)

```bash
git clone https://aur.archlinux.org/paraninfodl.git
cd paraninfodl
makepkg -si
```

Or with an AUR helper:

```bash
yay -S paraninfodl
# or
paru -S paraninfodl
```

### From source

```bash
git clone https://github.com/El-Mundos/paraninfodl
cd paraninfodl
pip install .
```

## Usage

```bash
paraninfodl <url>
```

The first run opens a browser window for Google login. The session is saved to `~/.paraninfo_session.json` and reused automatically from then on.

## Options

| Flag | Description |
|------|-------------|
| `-o PATH` | Output path for the PDF. Can be a file or a directory. Defaults to `./<book-slug>.pdf`. |
| `--quality N` | Re-encode images at JPEG quality N (1–95). Lower = smaller file. Omit for lossless. |
| `--text-layer` | Add a selectable/searchable text layer to the PDF. |
| `--keep-pages` | Keep the downloaded page images after building the PDF. |

## Examples

```bash
# Lossless PDF
paraninfodl https://ebooks.paraninfo.es/reader/my-book

# Compressed + searchable text
paraninfodl https://ebooks.paraninfo.es/reader/my-book --quality 75 --text-layer

# Keep page images for inspection
paraninfodl https://ebooks.paraninfo.es/reader/my-book --keep-pages
```

## Notes

- Only works with books your account has access to.
- The saved session (`~/.paraninfo_session.json`) contains your cookies — don't share it.
- Page images are cached in `~/.cache/paraninfodl/<book-slug>/` and deleted after the PDF is built (unless `--keep-pages` is set). Re-running resumes from where it left off regardless of which directory you run from.
