What it is
Reddit Fetch is a skill from ykdojo's Claude Code Tips repository that solves the problem of Reddit's aggressive bot restrictions blocking direct API access. The technique uses a DuckDuckGo redirect to establish a valid session: first, the agent navigates to a DuckDuckGo search for the target subreddit, extracts the first result's redirect URL containing a session token, and follows that redirect to land on Reddit with a valid session cookie. Once the session is established, the agent can directly fetch Reddit's JSON API endpoints like /r/SUBREDDIT/hot.json for post listings and /r/SUBREDDIT/comments/POST_ID.json for threads with comments. All navigation must use Playwright browser automation rather than curl (which gets 403 errors), and JSON parsing should be wrapped in try/catch to detect stale sessions. Sequential requests require 2-3 second delays between calls.
Who it's for
- AI agents needing Reddit data
- developers building research tools that query Reddit
- Claude Code users wanting to fetch subreddit content
Requirements
Requirements
- Playwright browser automation
- www.reddit.com access (not old.reddit.com)
Setup
Step 1
bashCopy skill to .claude/skills/reddit-fetch/ from the claude-code-tips repository
يمكن الوكلاء من جلب المحتوى من واجهة Reddit JSON عبر تجاوز قيود الروبوتات باستخدام تقنية إعادة توجيه DuckDuckGo عبر متصفح Playwright.
Examples
List subreddit posts
Codeconst data = JSON.parse(document.body.innerText);
return data.data.children.map(c => ({title: c.data.title, score: c.data.score}));What it does: After navigating to /r/SUBREDDIT/hot.json?limit=15 via the DuckDuckGo hop, evaluates the page content to extract post titles and scores.
Pros & cons
Pros
- Pro:Bypasses Reddit's aggressive bot blocking without API keys
- Pro:Works with standard JSON endpoints for posts and comments
- Pro:No Reddit API credentials or OAuth setup required
Cons
- Con:Depends on DuckDuckGo redirect behavior which could change
- Con:Requires Playwright browser automation overhead
- Con:Sequential requests need 2-3 second delays to avoid rate limiting
- Con:Sessions may go stale requiring the DuckDuckGo hop to be repeated