home / skills / ykdojo / claude-code-tips / reddit-fetch

reddit-fetch skill

/skills/reddit-fetch

This skill fetches Reddit content using Gemini CLI when WebFetch is blocked, enabling quick research and data gathering.

npx playbooks add skill ykdojo/claude-code-tips --skill reddit-fetch

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.1 KB
---
name: reddit-fetch
description: Fetch content from Reddit using Gemini CLI when WebFetch is blocked. Use when accessing Reddit URLs, researching topics on Reddit, or when Reddit returns 403/blocked errors.
---

# Reddit Fetch via Gemini CLI

When WebFetch fails to access Reddit (blocked, 403, etc.), use Gemini CLI via tmux.

Pick a unique session name (e.g., `gemini_abc123`) and use it consistently throughout.

## Setup

```bash
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
```

## Send query and capture output

```bash
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
```

## How to tell if Enter was sent

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.

## Cleanup when done

```bash
tmux kill-session -t <session_name>
```

Overview

This skill provides a reliable method to fetch Reddit content using the Gemini CLI inside a tmux session when direct WebFetch access is blocked or returns 403 errors. It standardizes a lightweight workflow to send queries, capture output, and verify submission state so you can extract Reddit threads and comments despite network restrictions. The approach is scriptable and intended for repeatable, automated research tasks.

How this skill works

You create a detached tmux session and run the Gemini CLI inside it. Queries are sent to the Gemini process via tmux send-keys, the session output is allowed time to generate, and tmux capture-pane extracts the response text. The method includes a simple visual check to determine whether Enter was actually submitted and a cleanup step to kill the tmux session when finished.

When to use it

  • WebFetch or browser-based access to Reddit is blocked, returns 403, or is unreliable.
  • You need to programmatically research Reddit threads or comments from a restricted environment.
  • Automating repeated Reddit queries in a headless server or CI pipeline.
  • When you want a reproducible, scriptable CLI-based fetch flow using Gemini as a proxy.
  • Short ad hoc lookups during development when a GUI client is unavailable.

Best practices

  • Pick a unique tmux session name and reuse it consistently for the job to avoid collisions.
  • Allow sufficient wait time after sending a query (start with 30s, increase up to 90s for complex searches).
  • Always capture pane output with a reasonable scrollback range (e.g., -S -500) to include full responses.
  • Detect whether Enter was actually sent by checking whether your query appears inside the tmux input box.
  • Kill the tmux session after the job to free resources and avoid stray background processes.

Example use cases

  • Researching subreddit threads for sentiment or topic summaries when direct scraping is blocked.
  • Collecting comment excerpts for a report when API or web access is restricted.
  • Embedding Reddit lookups into a larger agentic workflow that uses Gemini as a helper.
  • Debugging why a Reddit URL returns 403 by reproducing the fetch from a different environment.
  • Running scheduled Reddit queries on a remote server without a browser session.

FAQ

How do I know if my query was submitted to Gemini?

If your typed query appears outside the boxed tmux input and you see processing activity, Enter was sent; if it remains inside the box, send an explicit Enter via tmux send-keys.

What wait time should I use after sending a query?

Start with 30 seconds and increase up to 90 seconds for complex searches or longer responses; adjust based on observed latency.