Skip to main content

Extract hyperlinks and their labels from .docx, .odt, .html, and .pdf documents.

Project description

# extract-links

**extract-links** is a command-line tool for extracting text-label + hyperlink pairs from .docx, .odt, .html, and .pdf files.

- PDF support includes intelligent bounding-box text parsing

- Outputs formats: txt, csv, md, json, xlsx

- Optional deduplication and sorting

- Works across Windows, Linux, macOS


## Install

Clone and install locally:

pip install .

Or use the CLI directly from source:

python -m extract\\\_links.cli \\\[file]

**Usage**

extract-links input.docx -o output --format csv --dedupe --sort

**Arguments**

| Flag       | Description                                   |

| ---------- | --------------------------------------------- |

| `input`    | Input file (`.docx`, `.odt`, `.html`, `.pdf`) |

| `-o`       | Output file prefix (no extension)             |

| `--format` | `txt`, `csv`, `md`, `json`, `xlsx`            |

| `--dedupe` | Deduplicate URLs                              |

| `--sort`   | Sort by label                                 |


**Example**

extract-links report.pdf -o links --format xlsx --dedupe --sort

**Output Example**

CSV


Text,URL

Project Plan,https://example.com/plan

Resources,https://example.com/resources

**Markdown**


\[Project Plan](https://example.com/plan)


**Supported Formats**

.docx  via python-docx
.odt  via odfpy
.html  via BeautifulSoup
.pdf  via PyMuPDF (bounding box + OCR-style matching)


## Windows Standalone `.exe`

For Windows users without Python, download the `.exe` from the [Releases](https://github.com/pqexpert/extract-links/releases) page.

### Example:
```powershell
extract-links.exe project_plan.docx -o pp_links_out --format csv

### Notes for `.exe` usage:
Place `extract-links.exe` in the same folder as your input file  
Or provide the full path to your input file when running  

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hyperlink_extractor_jda-1.3.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hyperlink_extractor_jda-1.3.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page