Metadata-Version: 2.1
Name: doi-fetcher
Version: 0.1.3
Summary: Download paper PDFs from Libgen using a DOI
Home-page: 
Author: Nicolas AIra
Author-email: 
License: MIT
Keywords: doi,libgen,pdf,papers,download
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: bs4
Requires-Dist: requests

# doi-fetcher

A minimal Python package and CLI to download paper PDFs from Libgen using a DOI.

## Install

```bash
pip install doi-fetcher
```

## CLI

```bash
# Download to the current directory (filename derived from DOI)
doi-fetcher 10.1006/viro.1998.9547

# Set output directory and filename
doi-fetcher 10.1006/viro.1998.9547 --output-dir ./papers --filename viro-1998.pdf

# Provide a full output path
doi-fetcher 10.1006/viro.1998.9547 -o /tmp/viro.pdf

# Use a specific mirror
doi-fetcher 10.1006/viro.1998.9547 --mirror li
```

Options:

- `-o, --output` Full output path. Overrides `--output-dir` and `--filename`.
- `--output-dir` Directory to save the PDF (default: current directory).
- `--filename` Filename to use (default: derived from DOI).
- `--mirror` Libgen mirror suffix (e.g. `li`) or full URL.
- `--fallback-mirror` Additional mirror suffix or URL to try if the primary fails. Can be used multiple times.
- `--no-fallback` Disable fallback mirrors.
- `--timeout` Request timeout in seconds (default: 60).

## Python usage

```python
from doi_fetcher import fetch_pdf_by_doi, DoiFetcher

# Simple helper
path = fetch_pdf_by_doi("10.1006/viro.1998.9547", output_dir="papers")

# Reusable fetcher
fetcher = DoiFetcher(mirror="li")
path = fetcher.fetch("10.1006/viro.1998.9547", output_path="paper.pdf")
```

Notes:
- The DOI can also be provided as a DOI URL (e.g. `https://doi.org/...`).
- If multiple results exist, the first PDF result is downloaded.
