reddit-fetch
यह क्या करती है
यह स्किल ब्राउज़र सेशन के ज़रिए Reddit से सामग्री लेती है, क्योंकि Reddit अक्सर स्वचालित पहुँच रोकता है। यह उन लोगों के लिए है जो किसी विषय पर Reddit की चर्चा से शोध कर रहे हैं।
कब इस्तेमाल करें
- ✓जब आप चाहते हैं कि आपका एजेंट शोध के लिए कोई Reddit थ्रेड या सबरेडिट पढ़े।
- ✓जब कोई Reddit लिंक ब्लॉक्ड या 403 त्रुटि लौटाए।
- ✓जब आप जानना चाहते हैं कि Reddit उपयोगकर्ता किसी प्रोडक्ट या विषय के बारे में क्या सोचते हैं।
Skill का लिंक
https://github.com/ykdojo/claude-code-tips/blob/main/skills/reddit-fetch/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“यह Reddit थ्रेड पढ़िए और बताइए कि नए लैपटॉप के बारे में लोग क्या सोचते हैं।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह स्किल पहले एक सर्च इंजन रीडायरेक्ट के ज़रिए Reddit तक पहुँचती है, ताकि ब्राउज़र सेशन Reddit का डेटा लोड कर सके। फिर वह उसी डेटा से पोस्ट और टिप्पणियाँ पढ़ती है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Reddit Fetch
Reddit's public JSON API works by appending .json to any Reddit URL — but Reddit now hard-blocks automated access. curl 403s essentially every time (host AND container, regardless of User-Agent), and even a cold Playwright navigation to reddit.com hits a "You've been blocked by network security" challenge page. The reliable method is to arrive at Reddit through a DuckDuckGo result redirect: that sets a Reddit session cookie which unlocks direct .json access for the rest of the browser session.
Primary method: the DuckDuckGo-hop unlock
Step 1 - the DDG hop. Do this once per session before any .json fetch.
mcp__playwright__browser_navigatetohttps://html.duckduckgo.com/html/?q=site:reddit.com/r/SUBREDDIT+YOUR+QUERY- Grab the first result's full href - it's a DDG redirect that includes a
ruttoken (https://duckduckgo.com/l/?uddg=...&rut=...). The token is required; navigating to the bare/l/?uddg=without it 400s.() => document.querySelector('.result__a')?.href browser_navigateto that full redirect href. It lands on a realwww.reddit.compage (title = the post/subreddit title, not "Blocked") and sets the session cookie. The result doesn't have to be the exact thread you want - landing on any real Reddit page sets the cookie.
If Playwright errors with Browser is already in use, a stale instance is holding the profile - pkill -f ms-playwright-mcp (or the profile dir named in the error) and retry.
Step 2 - direct .json now works. For the rest of the session, navigate Playwright straight to any .json URL and JSON.parse(document.body.innerText). Use www.reddit.com (not old.reddit.com) for browser navigation. Full recency sorting (sort=new&t=week) is available.
browser_navigateto e.g.https://www.reddit.com/r/SUBREDDIT/search.json?q=QUERY&restrict_sr=on&sort=new&t=week&limit=25browser_evaluate, always wrapped in try/catch (returndocument.body.innerText.slice(0,200)on failure so you can see a challenge page if the session lapsed - just re-do the hop):() => { try { const data = JSON.parse(document.body.innerText); return data.data.children.map(c => ({ t: c.data.title, s: c.data.score, n: c.data.num_comments, id: c.data.id })); } catch (e) { return document.body.innerText.slice(0, 200); } }- For a thread, navigate to
.../comments/POST_ID.json?limit=30&sort=topand parsedata[0](post) anddata[1].data.children(comments).
JSON shapes (same for browser and curl)
# Listing - swap hot for new/top/rising; for top add &t=day|week|month|year|all
/r/SUBREDDIT/hot.json?limit=15
# Post + comments - JSON array where [0]=post, [1]=comment tree
/r/SUBREDDIT/comments/POST_ID.json?limit=20
# Search within a subreddit
/r/SUBREDDIT/search.json?q=QUERY&restrict_sr=on&sort=new&limit=15
- Listings:
.data.children[].datahastitle,score,num_comments,author,id. - Threads:
[0].data.children[0].datais the post;[1].data.children[](filterkind == "t1") are comments withauthor,score,body, and nestedrepliesof the same shape. - Truncate long comment bodies (e.g.
body.slice(0, 300)in JS,.body[:300]in jq 1.7+) to keep output readable.
Fallbacks
- More comments per thread: load the rendered thread page (after the hop) and scrape the
shredditDOM - it returns more comments than.json?limit=:() => ({ title: document.querySelector('shreddit-post')?.getAttribute('post-title'), comments: [...document.querySelectorAll('shreddit-comment')].map(c => ({ author: c.getAttribute('author'), score: c.getAttribute('score'), text: c.querySelector('.md')?.innerText })) }) - No Playwright at all: use Claude for Chrome to open the thread /
.jsonURL and read it off the page. - curl (last resort, expect 403): direct curl with a browser User-Agent used to work and is faster when it does, but it now gets 403'd essentially always - changing the UA doesn't help. Only worth a single quick try if you're already shelling out and a browser isn't available; on 403, go straight to the DDG hop.
UA="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" curl -s -L -o /tmp/reddit_result.txt -w "%{http_code}" -H "User-Agent: $UA" \ 'https://old.reddit.com/r/SUBREDDIT/hot.jso
अक्सर पूछे जाने वाले सवाल
सर्च इंजन वाला चरण क्यों ज़रूरी है?
Reddit सीधी स्वचालित पहुँच रोकता है, इसलिए सर्च परिणाम के ज़रिए जाने पर ब्राउज़र सेशन डेटा लोड कर पाता है।
यह कौन सा टूल इस्तेमाल करती है?
यह Reddit पेज और उनका डेटा लोड करने के लिए Playwright ब्राउज़र इस्तेमाल करती है।
क्या यह हमेशा काम करेगी?
हमेशा नहीं। Reddit के ब्लॉकिंग नियम बदलते रहते हैं, इसलिए यह तरीका हर बार काम न करे।
जानकारी
लेखक का मूल विवरण
Fetch content from Reddit via its JSON API using a browser session (DuckDuckGo-hop unlock). Use when accessing Reddit URLs, researching topics on Reddit, or when Reddit returns 403/blocked errors.
repo: ykdojo/claude-code-tips
लोकप्रियता
- GitHub स्टार
- 10k
- रैंकिंग में स्थान
- #11904
- लाइसेंस
- —
- अपडेट की गई
- 25/9/2026
कमेंट
- …
इस repository की और skills
gha
10kGitHub Actions वर्कफ़्लो क्यों विफल हुआ, यह पता लगाती है, और यह भी कि वही जॉब बार-बार विफल हो रहा है या नहीं।
half-clone
10kआपके एजेंट को लंबी चैट का बाद वाला आधा हिस्सा नए सेशन में कॉपी करने में मदद करती है, ताकि कम टोकन लगें और हाल का काम बचा रहे।
handoff
10kआपके एजेंट को HANDOFF.md दस्तावेज़ लिखने में मदद करती है, ताकि नई चैट लक्ष्य, प्रगति और अगले कदमों के साथ प्रोजेक्ट को आगे बढ़ा सके।
hn-summarize
10kआपके एजेंट को Hacker News की टॉप स्टोरी, या किसी एक स्टोरी और उसकी टिप्पणियों का सार बनाने में मदद करती है, आधिकारिक डेटा से।
मिलती-जुलती skills
graincrawl
394kयह आपके एजेंट को सेव की गई Granola मीटिंग नोट्स और ट्रांसक्रिप्ट में खोजने, उनकी ताज़गी जांचने और किसी अवधि के हिसाब से गिनती करने देती है।
notcrawl
394kयह आपके एजेंट को Notion वर्कस्पेस की सेव की गई कॉपी में खोजने, पेज और डेटाबेस देखने और पेजों को Markdown फ़ाइलों में निर्यात करने देती है।
knowledge-entities
394kयह आपके एजेंट को लोगों, कंपनियों और प्रोजेक्ट्स की पहचान करने और आपके Knowledge vault में स्रोत-आधारित प्रोफ़ाइल पेज लिखने देती है।