Composable Reddit crawler CLI with lazy pipelines, powerful filtering, reproducible datasets, and flexible output formats.
Project description
praw-cli
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
# fetch a user's recent posts as a terminal table
praw-cli user spez --mode posts --limit 20 --format table
# re-process a saved dataset offline — no API, no credentials needed
praw-cli input posts.jsonl --filter "score>=500" --format csv --output filtered.csv
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
--resumeinterrupted sessions without refetching from scratch. - Offline Re-processing (
input): Apply new filters, change output formats, or extract field subsets from any previously saved.jsonl,.json, or.csvfile — without touching the API or needing credentials. Pipe from stdin too.
Zero-Code Data Preparation
- Data Science-Focused DSL: Stop writing custom Python scripts just to filter text. Chain
--filterconditions 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).
- NLP Cleaning: Keep long-form content using
- 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), standardjson,csv(for R/Excel), or rich console tables and Markdown reports. - Multi-Sink Pipeline: Write the raw data to a
.jsonldatabase while simultaneously writing a preview to a.csvsummary in a single pass.
Built-in Scientific Rigor
- Crawl Manifests: Every execution automatically generates a
.manifest.jsondetailing 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.1with 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.
- Getting Started: Installation and Authentication
- Usage Guide:
- Development:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file praw_cli-0.7.0.tar.gz.
File metadata
- Download URL: praw_cli-0.7.0.tar.gz
- Upload date:
- Size: 55.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98b30685dac110abb64bafbefc7f6e923bf01b2c4a8d86b25547c262f0c358e3
|
|
| MD5 |
de7683b0ae1841efe34982afa20d6977
|
|
| BLAKE2b-256 |
0b15fa6d80c2c7daab0071ee14b704356966ec2fc6dcd5c18d30b4e36b662ffe
|
Provenance
The following attestation bundles were made for praw_cli-0.7.0.tar.gz:
Publisher:
pypi-publish.yml on othonhugo/praw-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
praw_cli-0.7.0.tar.gz -
Subject digest:
98b30685dac110abb64bafbefc7f6e923bf01b2c4a8d86b25547c262f0c358e3 - Sigstore transparency entry: 2176382658
- Sigstore integration time:
-
Permalink:
othonhugo/praw-cli@26549906bd14b52e075ca734b10952f19982ee7f -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/othonhugo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@26549906bd14b52e075ca734b10952f19982ee7f -
Trigger Event:
release
-
Statement type:
File details
Details for the file praw_cli-0.7.0-py3-none-any.whl.
File metadata
- Download URL: praw_cli-0.7.0-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ce9220dc967b6fec312a28a45239c9029ea0d11d508c78732d073d7fc99c397
|
|
| MD5 |
5cfdc4b16857b124aa97e40f73d5bcc8
|
|
| BLAKE2b-256 |
1f8d949737a98997b9831ecb959aee08de9a08ece57958d2a032ecd53b600e70
|
Provenance
The following attestation bundles were made for praw_cli-0.7.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on othonhugo/praw-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
praw_cli-0.7.0-py3-none-any.whl -
Subject digest:
9ce9220dc967b6fec312a28a45239c9029ea0d11d508c78732d073d7fc99c397 - Sigstore transparency entry: 2176382853
- Sigstore integration time:
-
Permalink:
othonhugo/praw-cli@26549906bd14b52e075ca734b10952f19982ee7f -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/othonhugo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@26549906bd14b52e075ca734b10952f19982ee7f -
Trigger Event:
release
-
Statement type: