reddit-fetch by ykdojo/claude-code-tips
npx skills add https://github.com/ykdojo/claude-code-tips --skill reddit-fetch通过 tmux 使用 Gemini CLI。它可以浏览、总结并回答关于 Reddit 内容的复杂问题。
选择一个唯一的会话名称(例如 gemini_abc123),并在整个过程中保持一致使用。
tmux new-session -d -s <session_name> -x 200 -y 50
tmux send-keys -t <session_name> 'gemini -m gemini-3-pro-preview' Enter
sleep 3 # 等待 Gemini CLI 加载
tmux send-keys -t <session_name> 'Your Reddit query here' Enter
sleep 30 # 等待响应(根据需要调整,复杂搜索最多 90 秒)
tmux capture-pane -t <session_name> -p -S -500 # 捕获输出
如果捕获的输出显示 API 错误(例如配额超限、模型不可用),请终止会话并重试,但不要使用 -m 标志(仅使用 gemini 不带模型参数)。这将回退到默认模型。
专门查找你的查询文本。它是在边框内部还是外部?
Enter 键未发送 - 你的查询文本在边框内部:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
╭─────────────────────────────────────╮
│ > Your actual query text here │
╰─────────────────────────────────────╯
Enter 键已发送 - 你的查询文本在边框外部,后面跟着活动:
> Your actual query text here
⠋ Our hamsters are working... (processing)
╭────────────────────────────────────────────╮
│ > Type your message or @path/to/file │
╰────────────────────────────────────────────╯
注意:空提示 Type your message or @path/to/file 总是出现在边框内 - 这是正常的。关键是你的查询文本是在边框内还是外。
如果你的查询文本在边框内,运行 tmux send-keys -t <session_name> Enter 来提交。
tmux kill-session -t <session_name>
如果重试时不带 -m 也失败,请回退到下面的方法二。
Reddit 的公共 JSON API 可以通过在任何 Reddit URL 后追加 .json 来使用。当 Gemini 不可用时(配额耗尽、API 错误等)使用此方法。
curl -s -H "User-Agent: Mozilla/5.0 (compatible; bot)" \
"https://www.reddit.com/r/SUBREDDIT/hot.json?limit=15"
根据需要将 hot 替换为 new、top 或 rising。对于 top,添加 &t=day(或 week、month、year、all)。
curl -s -H "User-Agent: Mozilla/5.0 (compatible; bot)" \
"https://www.reddit.com/r/SUBREDDIT/comments/POST_ID.json?limit=20"
响应是一个 JSON 数组:[0] 是帖子,[1] 是评论树。
curl -s -H "User-Agent: Mozilla/5.0 (compatible; bot)" \
"https://www.reddit.com/r/SUBREDDIT/search.json?q=QUERY&restrict_sr=on&sort=new&limit=15"
使用 python3 内联提取所需内容:
curl -s -H "User-Agent: Mozilla/5.0 (compatible; bot)" \
"https://www.reddit.com/r/SUBREDDIT/hot.json?limit=15" | python3 -c "
import json, sys
data = json.loads(sys.stdin.read())
for i, post in enumerate(data['data']['children'], 1):
p = post['data']
flair = p.get('link_flair_text', '') or ''
print(f'{i}. [{flair}] {p[\"title\"]}')
print(f' {p[\"score\"]} pts | {p[\"num_comments\"]} comments | u/{p[\"author\"]}')
print()
"
如果 JSON API 返回空响应或 HTTP 429,你可能被限速了。稍等片刻再重试,或尝试使用不同的 User-Agent 字符串。
每周安装数
181
代码仓库
GitHub 星标数
6.7K
首次出现
2026年1月24日
安全审计
已安装于
codex156
gemini-cli155
opencode154
cursor154
cline152
github-copilot151
Use Gemini CLI via tmux. It can browse, summarize, and answer complex questions about Reddit content.
Pick a unique session name (e.g., gemini_abc123) and use it consistently throughout.
tmux new-session -d -s <session_name> -x 200 -y 50
tmux send-keys -t <session_name> 'gemini -m gemini-3-pro-preview' Enter
sleep 3 # wait for Gemini CLI to load
tmux send-keys -t <session_name> 'Your Reddit query here' Enter
sleep 30 # wait for response (adjust as needed, up to 90s for complex searches)
tmux capture-pane -t <session_name> -p -S -500 # capture output
If the captured output shows an API error (e.g., quota exceeded, model unavailable), kill the session and retry without the -m flag (just gemini with no model argument). This falls back to the default model.
Look for YOUR QUERY TEXT specifically. Is it inside or outside the bordered box?
Enter NOT sent - your query is INSIDE the box:
╭─────────────────────────────────────╮
│ > Your actual query text here │
╰─────────────────────────────────────╯
Enter WAS sent - your query is OUTSIDE the box, followed by activity:
> Your actual query text here
⠋ Our hamsters are working... (processing)
╭────────────────────────────────────────────╮
│ > Type your message or @path/to/file │
╰────────────────────────────────────────────╯
Note: The empty prompt Type your message or @path/to/file always appears in the box - that's normal. What matters is whether YOUR query text is inside or outside the box.
If your query is inside the box, run tmux send-keys -t <session_name> Enter to submit.
tmux kill-session -t <session_name>
If retrying without -m also fails, fall back to Method 2 below.
Reddit's public JSON API works by appending .json to any Reddit URL. Use this when Gemini is unavailable (quota exhausted, API errors, etc.).
curl -s -H "User-Agent: Mozilla/5.0 (compatible; bot)" \
"https://www.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 -H "User-Agent: Mozilla/5.0 (compatible; bot)" \
"https://www.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 -H "User-Agent: Mozilla/5.0 (compatible; bot)" \
"https://www.reddit.com/r/SUBREDDIT/search.json?q=QUERY&restrict_sr=on&sort=new&limit=15"
Use python3 inline to extract what you need:
curl -s -H "User-Agent: Mozilla/5.0 (compatible; bot)" \
"https://www.reddit.com/r/SUBREDDIT/hot.json?limit=15" | python3 -c "
import json, sys
data = json.loads(sys.stdin.read())
for i, post in enumerate(data['data']['children'], 1):
p = post['data']
flair = p.get('link_flair_text', '') or ''
print(f'{i}. [{flair}] {p[\"title\"]}')
print(f' {p[\"score\"]} pts | {p[\"num_comments\"]} comments | u/{p[\"author\"]}')
print()
"
If the JSON API returns empty responses or HTTP 429, you may be rate-limited. Wait a moment and retry, or try with a different User-Agent string.
Weekly Installs
181
Repository
GitHub Stars
6.7K
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
codex156
gemini-cli155
opencode154
cursor154
cline152
github-copilot151
lark-cli 共享规则:飞书资源操作指南与权限配置详解
39,000 周安装
学术海报生成器posterskill:从Overleaf论文一键生成交互式会议海报
522 周安装
Shopify CLI设置教程:获取管理员API访问令牌,实现产品内容管理自动化
482 周安装
Tiptap 富文本编辑器:React 19+ 与 Tailwind v4 集成指南,支持 SSR 和自定义扩展
478 周安装
AI SDK Core:Vercel AI SDK v5/v6 后端AI开发工具包 - 支持OpenAI、Anthropic、Google模型
479 周安装
App Store市场脉搏分析工具:ASO专家必备的榜单、关键词、推荐应用监控技能
493 周安装
LinkedIn URL查找配方 - 集成GTM元技能,自动化处理社交网络数据
518 周安装