Skip to main content

pagepull

Extract structured data from HTML pages via the command line.

pagepull wraps BeautifulSoup behind a simple CLI, turning common DOM extraction tasks into one-liners. Think of it as jq for HTML.

Install

pip install pagepull

Or with pipx for isolated install:

pipx install pagepull

Quick Start

# Extract the content div from a WordPress page
pagepull div entry-content https://example.com/about

# Same thing, as markdown
pagepull div entry-content --markdown https://example.com/about

# List images and check for missing alt text
pagepull images --alt https://example.com/about

# Pull meta tags
pagepull meta --title --description https://example.com/about

# Use any CSS selector
pagepull select "nav.primary a" page.html

Input

pagepull accepts three input types:

# Local file
pagepull div content page.html

# URL (fetched automatically)
pagepull div content https://example.com/page

# stdin
curl -s https://example.com | pagepull div content

Commands

div — Extract a div by class or id

pagepull div entry-content page.html
pagepull div sidebar --by id page.html
pagepull div entry-content --strip script,style --markdown page.html

images — List images with metadata

pagepull images page.html
pagepull images --alt --dimensions page.html
pagepull images --json page.html

Flags --alt to show alt text (missing alt flagged as [MISSING]) and --dimensions for width/height.

meta — Extract meta tags

pagepull meta page.html                         # all meta tags
pagepull meta --title --description page.html   # specific tags
pagepull meta --og page.html                    # Open Graph tags
pagepull links page.html
pagepull links --external-only page.html
pagepull links --csv page.html

headings — Heading hierarchy

pagepull headings page.html
h1: Welcome to Our Site
  h2: About Us
  h2: Services
    h3: Web Design

text — Visible text only

pagepull text page.html
pagepull text --selector "div.entry-content" page.html

select — Raw CSS selector

pagepull select "nav a" page.html
pagepull select "img[alt='']" --json page.html
pagepull select "h2 + p" --text page.html

strip — Remove elements

pagepull strip script noscript style page.html

table — Extract HTML tables

pagepull table --csv page.html
pagepull table --index 0 --json page.html

Global Flags

Flag Description
--selector <css> Scope any command to a CSS selector first
--json Structured JSON output
--csv CSV output (where applicable)
--markdown Convert HTML to markdown
--quiet Suppress headers and labels

Scoping with --selector

Any command can be scoped to a portion of the page:

# Images only within the article
pagepull images --alt --selector "article" page.html

# Links only in the footer
pagepull links --selector "footer" page.html

# Text from a specific section
pagepull text --selector "div.entry-content" page.html

Pairing with sitewalker

pagepull handles one page. sitewalker crawls sites. Together they cover site-wide extraction:

# Audit alt text across an entire site
sitewalker -p https://example.com | xargs -I{} pagepull images --alt --json {}

# Extract every page title
sitewalker -p https://example.com | xargs -I{} pagepull meta --title {}

# Pull article content as markdown
sitewalker -p https://example.com | xargs -I{} pagepull div content --markdown {}

Development

git clone git@github.com:cadentdev/pagepull.git
cd pagepull
poetry install
poetry run pytest

Requirements

  • Python 3.11+
  • Dependencies: beautifulsoup4, requests, markdownify

License

MIT

Metadata

Release files for pagepull 0.2.0

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

Source distribution (sdist)

Source distribution for pagepull 0.2.0
File Size Uploaded Provenance Actions
pagepull-0.2.0.tar.gz 6.4 kB Without provenance Details for pagepull-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pagepull 0.2.0
File Interpreter ABI Platform Actions
pagepull-0.2.0-py3-none-any.whl Python 3 none any Details for pagepull-0.2.0-py3-none-any.whl

Total release size: 16.8 kB

Release files / pagepull-0.2.0.tar.gz

Download URL pagepull-0.2.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a7b0e638c6f415157a03f0005c94258a261043f7d12456067f2a548777c15a39
BLAKE2b-256 checksum
How to use checksums
a6e5fa8ea84f26cf3b90782a29d65df0a575ca6f5709795c3dc4020357e630f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.12.3 Linux/6.8.0-107-generic

Release files / pagepull-0.2.0-py3-none-any.whl

Download URL pagepull-0.2.0-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8efe50706a3de9fdb5745cbcb03835bcb14287844e68d22dad05ac9c13584ad7
BLAKE2b-256 checksum
How to use checksums
a380845e9cfdbeb1c8f895533e3a2be5beee2026a70cc9d4b011e5b4bc600cae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.12.3 Linux/6.8.0-107-generic

Security for pagepull 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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