From dx
Fetches Reddit content via the curl JSON API when users share Reddit URLs, need research from subreddits, or encounter 403/blocked errors on Reddit. Provides bash one-liners for listing posts, fetching threads, searching, and parsing with jq.
How this skill is triggered — by the user, by Claude, or both
Slash command
/dx:reddit-fetchThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Reddit's public JSON API works by appending `.json` to any Reddit URL.
Reddit's public JSON API works by appending .json to any Reddit URL.
curl -s -L -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" \
"https://old.reddit.com/r/SUBREDDIT/hot.json?limit=15"
Replace hot with new, top, or rising as needed. For top, add &t=day (or week, month, year, all).
curl -s -L -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" \
"https://old.reddit.com/r/SUBREDDIT/comments/POST_ID.json?limit=20"
The response is a JSON array: [0] is the post, [1] is the comment tree.
curl -s -L -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" \
"https://old.reddit.com/r/SUBREDDIT/search.json?q=QUERY&restrict_sr=on&sort=new&limit=15"
Use jq to extract what you need:
# List posts
curl -s -L -o /tmp/reddit_result.txt -w "%{http_code}" \
-H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" \
'https://old.reddit.com/r/SUBREDDIT/hot.json?limit=15'
jq -r '.data.children[] | .data | "\(.title)\n \(.score) pts | \(.num_comments) comments | u/\(.author) | id: \(.id)\n"' /tmp/reddit_result.txt
# List comments from a specific post (the [1] element has comments)
jq -r '.[1].data.children[] | select(.kind == "t1") | .data | "u/\(.author) (\(.score) pts):\n \(.body[:300])\n"' /tmp/reddit_thread.txt
Key details:
-o /tmp/file and -w "%{http_code}" saves the response and prints the HTTP status (useful for debugging empty responses)-L follows redirects (old.reddit.com sometimes redirects)& in query strings.body[:300] truncates long comment bodies (jq 1.7+)Reddit's JSON API rate-limits aggressively:
sleep 2 or sleep 3 between each.npx claudepluginhub ykdojo/claude-code-tips --plugin dxReads public Reddit data via UnifAPI: subreddit profiles, thread comment trees, user activity, feeds, and trending searches. Read-only, seed-driven discovery.
Automates Reddit actions via Rube MCP/Composio: search subreddits, create text/link posts, manage comments. Useful for Reddit content management or research workflows.
Automates Reddit tasks via Rube MCP/Composio: search subreddits/posts, create posts with flairs, retrieve/manage comments. Requires active Reddit OAuth connection.