agentleFS
mothivenkateshmothivenkatesh/reddit-scraper/SKILL.md

reddit-scraper

Skill1 starsChanged 7 months agoMITView on GitHub

Pull Reddit content via public JSON endpoints. Scrapes user history (submissions + comments), subreddit feeds (new/hot/top/rising/controversial), or whole threads with every comment. No login, no browser, no Scrapling. Outputs JSON per target plus a flat CSV. Use for user research, voice-of-customer mining, community analysis, or building datasets for LLM fine-tuning.

  • Installs packages

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. hesongshuaige/claude-skills★ 0same name
    2. luis2404123/birdproxies-skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If you hit 429, the scraper waits 5, 10, 15 seconds and retries.

    line 87

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/reddit-scrape

Scrape Reddit using <url>.json public endpoints. No auth. No Playwright. Just requests and JSON parsing. Very fast (hundreds of posts per minute) and low ban risk.

Usage

/reddit-scrape user <username>                       # submissions + comments for one user
/reddit-scrape users u1,u2,u3                        # many users
/reddit-scrape subreddit <name>                      # subreddit feed (default sort=new)
/reddit-scrape subreddit <name> --sort top --max 1000
/reddit-scrape thread <url>                          # single thread with all comments
/reddit-scrape file targets.txt                      # mixed file (u/x, r/y, https://...)
/reddit-scrape csv                                   # flatten data/*.json to all.csv

Sort options for subreddits: new, hot, top, rising, controversial. Max default is 500 items per target.

What Claude must do when invoked

Step 1 - Resolve

SKILL_DIR = directory holding this SKILL.md. WORKSPACE defaults to ./reddit-scrape in cwd (override with --out-dir).

Step 2 - Ensure dependencies

python -c "import requests" 2>/dev/null || python -m pip install -q requests

That's it. No browser, no Scrapling, no Playwright.

Step 3 - Route the subcommand

user <u> or users u1,u2,u3:

python "$SKILL_DIR/scrape.py" --user <u> --out-dir "$WORKSPACE" [--max 500]
python "$SKILL_DIR/scrape.py" --users "u1,u2,u3" --out-dir "$WORKSPACE"

subreddit <name>:

python "$SKILL_DIR/scrape.py" --subreddit <name> \
  --sort <new|hot|top|rising|controversial> --max 500 --out-dir "$WORKSPACE"

thread <url>:

python "$SKILL_DIR/scrape.py" --thread "<url>" --out-dir "$WORKSPACE"

file <path> - mixed targets, one per line. The script auto-detects:

  • u/<name> or /u/<name> -> user scrape
  • r/<name> or /r/<name> -> subreddit scrape (uses current --sort)
  • https://... -> thread scrape
  • Lines starting with # are ignored
python "$SKILL_DIR/scrape.py" --file "<path>" --sort new --max 500 --out-dir "$WORKSPACE"

csv:

python "$SKILL_DIR/to_csv.py" --data-dir "$WORKSPACE/data" --out "$WORKSPACE/all.csv"

The CSV handles all three shapes (user, subreddit, thread) and tags each row with a kind column (submission or comment).

Step 4 - Summarize

Per target: count of submissions, comments, or posts. Flag any 404s (deleted user or subreddit).

Notes

Reddit's rate limits

Reddit's unauthenticated JSON endpoints allow about 60 requests per minute from a single IP. The scraper waits 1.5 seconds between requests (polite), so one run hits roughly 40/min. No authentication token needed.

If you hit 429, the scraper waits 5, 10, 15 seconds and retries. If you're still throttled after 3 tries it gives up on that page and moves on.

Subreddit max is ~1000

Reddit's listing endpoints hard-cap at 1000 items via after= pagination, no matter what you pass to --max. For deeper history, use pushshift or the official Reddit API via PRAW.

Comment trees

For threads, the scraper flattens the nested comment tree into a flat list with depth and parent_id columns so you can reconstruct the thread. It skips "load more" placeholders (you'd need PRAW or a second fetch per placeholder to expand those).

Legal

Reddit's content is CC-licensed user content. Reading it via the public JSON endpoint is explicitly supported ("add .json to any URL" is in their old docs). Reasonable personal research, LLM training, and analytics are fine. Don't redistribute user content as your own or build a Reddit clone.

For commercial bulk use, use the official Reddit API via PRAW with a registered app (free, 1000 requests/hour).

Files

  • scrape.py - hits Reddit's JSON endpoints with retry and pagination
  • to_csv.py - flatten any mix of user/subreddit/thread exports to one CSV

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.