reddit-fetch
Skill này làm gì
Skill này lấy nội dung từ Reddit qua một phiên trình duyệt, vì Reddit thường chặn truy cập tự động. Nó dành cho người nghiên cứu một chủ đề đang được thảo luận trên Reddit.
Khi nào nên dùng
- ✓Khi bạn muốn agent đọc một chuỗi hoặc subreddit trên Reddit để nghiên cứu.
- ✓Khi một liên kết Reddit trả về lỗi bị chặn hoặc 403.
- ✓Khi bạn muốn biết người dùng Reddit nghĩ gì về một sản phẩm hoặc chủ đề.
Liên kết skill
https://github.com/ykdojo/claude-code-tips/blob/main/skills/reddit-fetch/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Đọc chuỗi Reddit này và cho tôi biết mọi người nghĩ gì về chiếc laptop mới.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill trước tiên đi đến Reddit qua một chuyển hướng từ công cụ tìm kiếm, cho phép phiên trình duyệt tải dữ liệu của Reddit. Sau đó nó đọc các bài và bình luận từ dữ liệu đó.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
Câu hỏi thường gặp
Vì sao cần bước công cụ tìm kiếm?
Reddit chặn truy cập tự động trực tiếp, nên đi qua một kết quả tìm kiếm cho phép phiên trình duyệt tải được dữ liệu.
Nó dùng công cụ nào?
Nó dùng trình duyệt Playwright để tải các trang Reddit và dữ liệu của chúng.
Nó có luôn hoạt động không?
Không phải lúc nào. Quy tắc chặn của Reddit thay đổi, nên phương pháp này có thể không hoạt động mọi lúc.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 10k
- Vị trí xếp hạng
- #11904
- Giấy phép
- —
- Cập nhật
- 25/9/2026
Bình luận
- …
Thêm skill từ kho mã này
gha
10kGiúp agent của bạn tìm hiểu vì sao một workflow GitHub Actions bị lỗi, và liệu cùng một job có liên tục bị lỗi hay không.
half-clone
10kGiúp agent của bạn sao chép nửa sau của một cuộc trò chuyện dài sang phiên làm việc mới, dùng ít token hơn nhưng vẫn giữ công việc gần đây của bạn.
handoff
10kGiúp agent của bạn viết tài liệu bàn giao để một cuộc trò chuyện mới có thể tiếp tục dự án với mục tiêu, tiến độ và bước tiếp theo rõ ràng.
hn-summarize
10kGiúp agent của bạn tóm tắt các bài nổi bật trên Hacker News, hoặc một bài và phần bình luận của nó, bằng dữ liệu chính thức của Hacker News.
Skill tương tự
graincrawl
394kCho phép agent của bạn tìm trong ghi chú cuộc họp và bản chép lời Granola đã lưu, kiểm tra độ mới và đếm số cuộc họp trong một khoảng thời gian.
notcrawl
394kCho phép agent của bạn tìm trong bản sao đã lưu của workspace Notion, tra cứu trang và database, rồi xuất trang ra file Markdown.
knowledge-entities
394kGiúp agent của bạn xác định người, công ty và dự án, rồi viết trang hồ sơ có nguồn cho họ trong kho Knowledge của bạn.