Skip to main content
skill CX Codex

reddit-fetch — Claude Code skill: read Reddit via JSON API

This skill pulls posts and comments off Reddit through its JSON API when automated access gets blocked. Handy for research threads your agent can't reach.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add ykdojo/claude-code-tips --skill reddit-fetch -a claude-code
Open on GitHub

What reddit-fetch does

Append .json to any Reddit URL and you get structured data — in theory. In practice Reddit blocks bots: curl returns 403 nearly every time regardless of User-Agent, and a fresh Playwright navigation to reddit.com lands on a network-security challenge. The skill's trick is arriving through a DuckDuckGo result redirect, which plants a Reddit session cookie and opens direct .json access for the rest of the browser session.

One hop per session. Search html.duckduckgo.com for site:reddit.com/r/SUBREDDIT, then grab the first result's full href — it carries a rut token, and the bare redirect URL without it returns 400. Navigating to that href lands on a real Reddit page and sets the cookie. After that, go straight to search.json, hot.json or comments/POST_ID.json and parse the body. Wrap the parse in try/catch: a lapsed session serves the challenge page instead of JSON, and you redo the hop.

Reddit throttles hard even once you're through, so fire requests one at a time with sleep 2 or sleep 3 between them. Zero-byte responses mean waiting 3–5 seconds; a 429 means backing off 10–15 seconds. If Playwright complains that the browser is already in use, pkill -f ms-playwright-mcp clears the stale profile. There's a fallback too — open the thread in a browser and read it off the rendered page.

What it helps with

  • pull a subreddit's newest posts from the past week
  • collect a thread's comments including nested replies
  • get around 403 errors when an agent hits reddit.com
  • find discussions on a topic inside one subreddit
  • read a thread when a plain browser visit hits a challenge page

Example prompts for the agent

  • Find this week's newest posts in r/programming and list titles with comment counts
  • Fetch the comments on this Reddit thread, sort by score, trim long ones to 300 characters
  • Reddit is returning 403 — go through DuckDuckGo and retry the fetch

How to install reddit-fetch

1Skills CLI (Vercel)

npx skills add ykdojo/claude-code-tips --skill reddit-fetch -a claude-code

2Manually: put the files in place

~/.claude/skills/reddit-fetch/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/reddit-fetch/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about reddit-fetch

How do I install reddit-fetch in Claude Code?

Run npx skills add ykdojo/claude-code-tips --skill reddit-fetch -a claude-code. The skill lands at ~/.claude/skills/reddit-fetch/SKILL.md.

What does reddit-fetch do?

It opens Reddit through a DuckDuckGo redirect to obtain a session cookie, then reads posts and comments from .json URLs. Use it when a direct request to Reddit gets blocked.

How is it different from a plain curl to Reddit?

A browser User-Agent on curl now draws a 403 almost every time, and swapping the UA doesn't help. The skill sets the cookie via a search redirect, after which .json works in the browser.

Similar skills

All skills for Browser and scraping →

From the same set4

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor