Skip to main content

Composable Reddit crawler CLI with lazy pipelines, powerful filtering, reproducible datasets, and flexible output formats.

Project description

praw-cli

Python 3.11+ Code style: ruff

A composable Reddit crawler for the command line. Fetch posts and comments from any source, shape the data through a lazy filter pipeline, and emit it in any format — all without writing a single line of Python.

# stream the top 500 posts from r/MachineLearning as JSONL
praw-cli posts r/MachineLearning --sort top --time year --limit 500 --format jsonl

# search across r/programming, keep only high-signal posts, project to four fields
praw-cli search "New web framework" --sub r/programming \
  --filter "score>=100" --filter "num_comments>=10" \
  --fields id,title,score,url --format csv --output results.csv

# full comment tree of a submission, depth-first, minimum score 5
praw-cli comments https://reddit.com/r/Python/comments/xyz/ \
  --depth 10 --min-score 5 --format jsonl

Key Features & How They Solve Your Problems

Smart Memory & Reliability

  • Constant Memory Footprint (Lazy Pipelines): Typical scrapers buffer huge arrays in memory, causing out-of-memory crashes on large crawls. praw-cli processes data lazily item-by-item (Iterator[Record]). Streaming 100,000 posts uses the same constant memory as streaming 10.
  • Resumable Extractions (Checkpointing): Long-running scrapes often fail halfway due to network drops or API limits. praw-cli checkpoints progress, letting you --resume interrupted sessions without refetching from scratch.

Zero-Code Data Preparation

  • Data Science-Focused DSL: Stop writing custom Python scripts just to filter text. Chain --filter conditions directly in the CLI:
    • NLP Cleaning: Keep long-form content using selftext len>= 500.
    • Temporal Sorting: Restrict dates natively using ISO-8601 strings, like created_utc >= 2024-01-01.
    • Targeted Mining: Target specific topics with keyword groupings (has, has_all) or regular expressions (title ~= \bbot\b).
  • Field Projections: Keep output datasets lightweight and clean by extracting only the schema columns you need (e.g., --fields id,title,score,author).

Instant Pandas & R Integrations

  • Diverse Output Formats: Stream outputs directly to jsonl (preferred for streaming/Pandas), standard json, csv (for R/Excel), or rich console tables and Markdown reports.
  • Multi-Sink Pipeline: Write the raw data to a .jsonl database while simultaneously writing a preview to a .csv summary in a single pass.

Built-in Scientific Rigor

  • Crawl Manifests: Every execution automatically generates a .manifest.json detailing exact parameters, versioning, records filtered, and a config fingerprint, preventing configuration drift in research environments.
  • Deterministic Sampling: Extract reproducible subsets of huge subreddits using systematic or randomized sampling (e.g., Bernoulli trial at rate = 0.1 with a fixed seed).

Installation

Requires Python 3.12 or later and a Reddit API application (free, read-only access is sufficient for most use cases).

Via PyPI (Recommended)

Install the package directly using pip or pipx:

pip install praw-cli

From Source (Using uv)

If you want to run it locally or contribute to development:

git clone https://github.com/othonhugo/praw-cli
cd praw-cli
uv sync
source .venv/bin/activate

Documentation

Full documentation is available in the docs/ directory.

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

praw_cli-0.6.0.tar.gz (52.6 kB view details)

Uploaded Source

Built Distribution

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

praw_cli-0.6.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file praw_cli-0.6.0.tar.gz.

File metadata

  • Download URL: praw_cli-0.6.0.tar.gz
  • Upload date:
  • Size: 52.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for praw_cli-0.6.0.tar.gz
Algorithm Hash digest
SHA256 d877d60c62dbe9062e12fc2a8ab9ce1802a2fcdb3ae4340b9289a405c02c0d78
MD5 9b03fbb9ce258b7e4a71a29fb5176e66
BLAKE2b-256 ff9832fb2cf45890219c0a067c3ab7da38bb13db5649a318a49705dabb44538e

See more details on using hashes here.

Provenance

The following attestation bundles were made for praw_cli-0.6.0.tar.gz:

Publisher: pypi-publish.yml on othonhugo/praw-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file praw_cli-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: praw_cli-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for praw_cli-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c64db954cd0ac1a5c794ff1f8bd57aae37561c8ec86a61c3938b1ab21a0d144
MD5 93bd0de0a91ab70d4e273a1a94f3eae5
BLAKE2b-256 cdcb7d061b516d4b9d5abeb0e9a1b4ec2474d48526a3a2b589f8c4eaa01c3a46

See more details on using hashes here.

Provenance

The following attestation bundles were made for praw_cli-0.6.0-py3-none-any.whl:

Publisher: pypi-publish.yml on othonhugo/praw-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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