Skip to content
Back to search

rdt-cli

SkillWorks with Claude CodeGitHub

Use rdt-cli for ALL Reddit operations — browsing feeds, reading posts, searching, viewing users, upvoting, saving, and subscribing. Invoke whenever the user requests any Reddit interaction.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/public-clis--rdt-cli/badge.svg)](/listings/public-clis--rdt-cli)

HTML

<a href="/listings/public-clis--rdt-cli"><img src="/api/listings/public-clis--rdt-cli/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

# Recommended: uv tool (fast, isolated)
uv tool install rdt-cli

# Or: pipx
pipx install rdt-cli

Upgrade to the latest version:

uv tool upgrade rdt-cli
# Or: pipx upgrade rdt-cli

From source:

git clone git@github.com:jackwener/rdt-cli.git
cd rdt-cli
uv sync

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

SKILL.md · Manifest · 250 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. ---
  2. name: rdt-cli
  3. description: Use rdt-cli for ALL Reddit operations — browsing feeds, reading posts, searching, viewing users, upvoting, saving, and subscribing. Invoke whenever the user requests any Reddit interaction.
  4. author: jackwener
  5. version: "0.4.0"
  6. tags:
  7. - reddit
  8. - rdt
  9. - social-media
  10. - cli
  11. ---
  12. # rdt-cli — Reddit CLI Tool
  13. **Binary:** `rdt`
  14. **Credentials:** browser cookies (auto-extracted via browser-cookie3)
  15. ## Setup
  16. ```bash
  17. # Install (requires Python 3.10+)
  18. uv tool install rdt-cli
  19. # Or: pip install rdt-cli
  20. # Upgrade
  21. uv tool upgrade rdt-cli
  22. ```
  23. ## Authentication
  24. **IMPORTANT FOR AGENTS**: Before executing ANY rdt command that requires auth, check if credentials exist.
  25. ### Step 0: Check if already authenticated
  26. ```bash
  27. rdt status --json 2>/dev/null | jq -r '.data.authenticated' | grep -q true && echo "AUTH_OK" || echo "AUTH_NEEDED"
  28. ```
  29. If `AUTH_OK`, skip to [Command Reference](#command-reference).
  30. If `AUTH_NEEDED`, proceed to Step 1.
  31. ### Step 1: Guide user to authenticate
  32. Ensure user is logged into reddit.com in a supported browser (Chrome, Firefox, Edge, Brave, Arc, Chromium, Opera, Vivaldi, Safari, LibreWolf). Then:
  33. ```bash
  34. rdt login
  35. ```
  36. Verify with:
  37. ```bash
  38. rdt status
  39. rdt whoami --json | jq '.data.name // .data._session.username'
  40. ```
  41. ### Step 2: Handle common auth issues
  42. | Symptom | Agent action |
  43. |---------|-------------|
  44. | `No Reddit cookies found` | Guide user to login to reddit.com in browser |
  45. | `Session expired` | Run `rdt logout && rdt login` |
  46. | `database is locked` | Close browser, then retry |
  47. ## Agent Defaults
  48. All machine-readable output uses the envelope documented in [SCHEMA.md](./SCHEMA.md).
  49. Payloads live under `.data`.
  50. - Non-TTY stdout → auto YAML
  51. - `--json` / `--yaml` → explicit format
  52. - `--compact` → fewer fields (agent token-efficient)
  53. - `--output file.json` → save structured output to file
  54. - Rich output → **stderr** (safe for pipes: `rdt search X --json | jq .data`)
  55. - Most read commands work without auth (public Reddit JSON API)
  56. - Write actions (upvote, save, subscribe) require auth + built-in 1.5-4s delay
  57. ## Command Reference
  58. ### Browsing
  59. | Command | Description | Example |
  60. |---------|-------------|---------|
  61. | `rdt feed` | Browse home feed (requires login) | `rdt feed -n 10 --json` |
  62. | `rdt feed --subs-only` | Subscriptions-only feed (no algorithm, sorted by time) | `rdt feed --subs-only -n 5 --json` |
  63. | `rdt popular` | Browse /r/popular | `rdt popular -n 5 --json` |
  64. | `rdt all` | Browse /r/all | `rdt all -n 10 --compact --json` |
  65. | `rdt sub <name>` | Browse a subreddit | `rdt sub python -s top -t week` |
  66. | `rdt sub-info <name>` | View subreddit info | `rdt sub-info rust --json` |
  67. | `rdt user <name>` | View user profile | `rdt user spez --json` |
  68. | `rdt user-posts <name>` | View user's posts | `rdt user-posts spez -n 5 --json` |
  69. | `rdt user-comments <name>` | View user's comments | `rdt user-comments spez -n 5 --json` |
  70. | `rdt saved` | View your saved items | `rdt saved -n 10 --json` |
  71. | `rdt upvoted` | View your upvoted posts | `rdt upvoted -n 10 --json` |
  72. | `rdt open <id_or_index>` | Open post in browser | `rdt open 3` |
  73. ### Reading
  74. | Command | Description | Example |
  75. |---------|-------------|---------|
  76. | `rdt read <post_id>` | Read a post + comments | `rdt read 1abc123 --json` |
  77. | `rdt read <post_id> --expand-more` | Expand top-level `more comments` | `rdt read 1abc123 --expand-more --json` |
  78. | `rdt show <index>` | Read by short-index | `rdt show 3` |
  79. | `rdt show <index> --expand-more` | Expand `more comments` from cached result | `rdt show 3 --expand-more --json` |
  80. | `rdt whoami` | View your profile (karma, age) | `rdt whoami --json` |
  81. ### Search & Export
  82. | Command | Description | Example |
  83. |---------|-------------|---------|
  84. | `rdt search <query>` | Search posts | `rdt search "python async" -s top -t year` |
  85. | `rdt search <query> -r <sub>` | Search in subreddit | `rdt search "error" -r rust --json` |
  86. | `rdt search <query> -o f.json` | Search + save to file | `rdt search "ML" -n 50 -o results.json` |
  87. | `rdt export <query>` | Export to CSV/JSON | `rdt export "ML" -n 50 -o results.csv` |
  88. ### Interactions (require auth)
  89. | Command | Description | Example |
  90. |---------|-------------|---------|
  91. | `rdt upvote <id_or_index>` | Upvote | `rdt upvote 3` |
  92. | `rdt upvote <id> --down` | Downvote | `rdt upvote 3 --down` |
  93. | `rdt upvote <id> --undo` | Remove vote | `rdt upvote 3 --undo` |
  94. | `rdt save <id_or_index>` | Save post | `rdt save 3` |
  95. | `rdt save <id> --undo` | Unsave | `rdt save 3 --undo` |
  96. | `rdt subscribe <sub>` | Subscribe | `rdt subscribe python` |
  97. | `rdt subscribe <sub> --undo` | Unsubscribe | `rdt subscribe python --undo` |
  98. | `rdt comment <id> <text>` | Post a comment | `rdt comment 3 "Great post!"` |
  99. ### Account
  100. | Command | Description |
  101. |---------|-------------|
  102. | `rdt login` | Extract cookies from browser |
  103. | `rdt logout` | Clear cached cookies |
  104. | `rdt status` | Check authentication status |
  105. | `rdt whoami` | View detailed profile info |
  106. ## Listing Options
  107. All listing commands (feed, popular, all, sub, user-posts, user-comments, saved, upvoted, search) support:
  108. | Flag | Description |
  109. |------|-------------|
  110. | `--json` | JSON output (with SCHEMA envelope) |
  111. | `--yaml` | YAML output (with SCHEMA envelope) |
  112. | `-o, --output FILE` | Save structured output to file |
  113. | `--full-text` | Show full title without truncation |
  114. | `-c, --compact` | Agent-friendly compact output (fewer fields) |
  115. ### Feed-specific Options
  116. | Flag | Description |
  117. |------|-------------|
  118. | `--subs-only` | Show only posts from subscribed subreddits (sorted by time, no algorithm) |
  119. | `--max-subs N` | Max subscriptions to fetch (default: 20) |
  120. ## Agent Workflow Examples
  121. ### Browse → Read → Upvote pipeline
  122. ```bash
  123. rdt sub python -s top -t week -n 5
  124. rdt show 1 --expand-more
  125. rdt upvote 1
  126. ```
  127. ### Search → Export pipeline (structured)
  128. ```bash
  129. rdt search "machine learning" -s top --compact --json | jq '.data'
  130. rdt export "machine learning" -n 100 -o ml_posts.csv
  131. ```
  132. ### Search → Save to file
  133. ```bash
  134. rdt search "rust async" -n 50 -o results.json
  135. rdt search "python tips" -n 20 --compact -o tips.json
  136. ```
  137. ### User research
  138. ```bash
  139. rdt user spez --json | jq '.data | {name, link_karma, comment_karma}'
  140. rdt user-posts spez -n 10 --compact --json
  141. rdt user-comments spez -n 10 --compact --json
  142. ```
  143. ### Saved / Upvoted review
  144. ```bash
  145. rdt saved -n 20 --compact --json
  146. rdt upvoted -n 20 --compact --json
  147. ```
  148. ### Subscriptions-only monitoring
  149. ```bash
  150. rdt feed --subs-only -n 5 --compact --json
  151. rdt feed --subs-only --max-subs 10 -o subs_feed.json
  152. ```
  153. ### Subreddit discovery
  154. ```bash
  155. rdt sub-info python --json | jq '.data | {subscribers, accounts_active}'
  156. rdt sub python -s top -t month -n 5 --full-text
  157. ```
  158. ## Sort Options
  159. - **Listing sort**: `hot`, `new`, `top`, `rising`, `controversial`, `best`
  160. - **Search sort**: `relevance`, `hot`, `top`, `new`, `comments`
  161. - **Time filter** (for top/controversial): `hour`, `day`, `week`, `month`, `year`, `all`
  162. - **Comment sort**: `best`, `top`, `new`, `controversial`, `old`, `qa`
  163. ## Error Codes
  164. Structured error codes returned in the `error.code` field (see [SCHEMA.md](./SCHEMA.md)):
  165. - `not_authenticated` — cookies expired or missing
  166. - `rate_limited` — too many requests
  167. - `not_found` — subreddit/user/post does not exist
  168. - `forbidden` — private subreddit or blocked user
  169. - `api_error` — upstream Reddit API error
  170. - `unknown_error` — unexpected error
  171. ## Limitations
  172. - **No DMs** — cannot access private messages
  173. - **No live/streaming** — live features not supported
  174. - **No media download** — cannot download images/videos
  175. - **Single account** — one set of cookies at a time
  176. - **Rate limited** — built-in Gaussian jitter (~1s) between requests
  177. - **Public API only** — uses .json suffix API, not OAuth endpoints
  178. ## Anti-Detection Notes for Agents
  179. - **Do NOT parallelize requests** — the built-in rate-limit delay is for account safety
  180. - **Write operation delay**: 1.5-4s random delay after each write (upvote/save/subscribe/comment)
  181. - **Batch operations**: add delays between CLI calls when doing bulk work
  182. - **Chrome 133 fingerprint**: all requests use consistent browser identity
  183. - **Exponential backoff**: 429/5xx errors are auto-retried with backoff
  184. ## Safety Notes
  185. - Do not ask users to share raw cookie values in chat logs
  186. - Prefer browser cookie extraction over manual secret copy/paste
  187. - If auth fails, ask the user to re-login via `rdt login`
  188. - Built-in rate-limit delay protects accounts; do not bypass it
README.md · README · 408 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # rdt-cli
  2. [![CI](https://github.com/jackwener/rdt-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/jackwener/rdt-cli/actions/workflows/ci.yml)
  3. [![PyPI version](https://img.shields.io/pypi/v/rdt-cli.svg)](https://pypi.org/project/rdt-cli/)
  4. [![Python](https://img.shields.io/badge/python-%3E%3D3.10-blue.svg)](https://pypi.org/project/rdt-cli/)
  5. A CLI for Reddit — browse feeds, read posts, search, and interact via reverse-engineered API 📖
  6. [English](#features) | [中文](#功能特性)
  7. ## More Tools
  8. - [xiaohongshu-cli](https://github.com/jackwener/xiaohongshu-cli) — Xiaohongshu CLI for search, reading, and posting
  9. - [twitter-cli](https://github.com/jackwener/twitter-cli) — Twitter/X CLI for timelines, bookmarks, and posting
  10. - [bilibili-cli](https://github.com/jackwener/bilibili-cli) — Bilibili CLI for videos, users, search, and feeds
  11. - [discord-cli](https://github.com/jackwener/discord-cli) — Discord CLI for local-first sync, search, and export
  12. - [tg-cli](https://github.com/jackwener/tg-cli) — Telegram CLI for local-first sync, search, and export
  13. ## Features
  14. - 🔐 **Auth** — auto-extract browser cookies, status check, whoami
  15. - 🏠 **Feed** — browse home feed, popular, /r/all, and subscription-only feed (`--subs-only`)
  16. - 📋 **Subreddits** — browse any subreddit with sort/time filters, view subreddit info
  17. - 📰 **Posts** — read posts and comment trees with syntax highlighting
  18. - 💬 **Expanded comments** — `--expand-more` loads additional `more comments` entries
  19. - 🔢 **Short-index navigation** — `rdt show 3` to read, `rdt open 3` to browser
  20. - 🔍 **Search** — full-text search with subreddit, sort, and time filters
  21. - 📤 **Export** — export search results to CSV or JSON; `-o file.json` on any listing
  22. - 👤 **Users** — view user profiles, post history, comment history, saved and upvoted items
  23. - ⬆️ **Interactions** — upvote/downvote, save/unsave, subscribe/unsubscribe, comment (with 1.5-4s rate-limit delay)
  24. - 🛡️ **Anti-detection** — consistent Chrome 133 fingerprint, `sec-ch-ua` alignment, Gaussian jitter, exponential backoff
  25. - 📊 **Structured output** — `--yaml`, `--json`, `--output FILE`, `--compact`, `--full-text`
  26. - 📦 **Stable envelope** — see [SCHEMA.md](./SCHEMA.md) for `ok/schema_version/data/error`
  27. - 🤖 **Agent-friendly** — Rich output on stderr, `--compact` for token-efficient output
  28. > **AI Agent Tip:** Prefer `--yaml` for structured output unless strict JSON is required. Non-TTY stdout defaults to YAML automatically. Use `--compact` to reduce token usage.
  29. ## Installation
  30. ```bash
  31. # Recommended: uv tool (fast, isolated)
  32. uv tool install rdt-cli
  33. # Or: pipx
  34. pipx install rdt-cli
  35. ```
  36. Upgrade to the latest version:
  37. ```bash
  38. uv tool upgrade rdt-cli
  39. # Or: pipx upgrade rdt-cli
  40. ```
  41. From source:
  42. ```bash
  43. git clone git@github.com:jackwener/rdt-cli.git
  44. cd rdt-cli
  45. uv sync
  46. ```
  47. ## Usage
  48. ```bash
  49. # ─── Auth ─────────────────────────────────────────
  50. rdt login # Extract cookies from browser
  51. rdt status # Check login status
  52. rdt status --json # Structured JSON envelope
  53. rdt whoami # Detailed profile (karma, account age)
  54. rdt logout # Clear saved cookies
  55. # ─── Browse ───────────────────────────────────────
  56. rdt feed # Home feed (requires login)
  57. rdt feed --subs-only # Subscriptions-only feed (no algorithm)
  58. rdt feed --subs-only -n 5 --max-subs 10 # Limit per-sub posts and max subs
  59. rdt popular # Popular posts
  60. rdt popular --full-text # Show full titles
  61. rdt all # /r/all
  62. rdt sub python # Browse subreddit
  63. rdt sub programming -s top -t week # Sort + time filter
  64. rdt sub-info python # Subreddit info (subscribers, etc.)
  65. rdt user spez # User profile
  66. rdt user-posts spez # User's submitted posts
  67. rdt user-comments spez # User's comments
  68. rdt saved # Your saved posts/items
  69. rdt upvoted # Your upvoted posts
  70. # Short index works after list commands (feed/popular/sub/search)
  71. rdt sub python
  72. rdt show 1 # Read post #1 from listing
  73. rdt open 1 # Open post #1 in browser
  74. rdt upvote 1 # Upvote post #1
  75. # ─── Reading ──────────────────────────────────────
  76. rdt read 1abc123 # Read post by ID
  77. rdt read 1abc123 --expand-more # Expand top-level "more comments"
  78. rdt show 3 # Read result #3 from last listing
  79. rdt show 3 --expand-more # Expand additional comments from cache-backed post
  80. rdt show 1 -s top # Sort comments by top
  81. rdt open 3 # Open in browser
  82. # ─── Search ───────────────────────────────────────
  83. rdt search "python async" # Global search
  84. rdt search "rust vs go" -r programming # Within subreddit
  85. rdt search "ML" -s top -t year # Sort by top, last year
  86. rdt search "AI" -o results.json # Save to file
  87. rdt search "rust" --compact --json # Compact agent output
  88. # ─── Export ───────────────────────────────────────
  89. rdt export "python tips" -n 100 -o tips.csv
  90. rdt export "rust" --format json -o results.json
  91. # ─── Interactions (require login) ─────────────────
  92. rdt upvote 3 # Upvote result #3
  93. rdt upvote 3 --down # Downvote
  94. rdt upvote 3 --undo # Remove vote
  95. rdt save 3 # Save result #3
  96. rdt save 3 --undo # Unsave
  97. rdt subscribe python # Subscribe to r/python
  98. rdt subscribe python --undo # Unsubscribe
  99. rdt comment 3 "Great post!" # Comment on result #3
  100. ```
  101. ## Authentication
  102. rdt-cli supports browser cookie extraction to authenticate with Reddit:
  103. 1. **Saved cookies** — loads from `~/.config/rdt-cli/credential.json`
  104. 2. **Browser cookies** — auto-detects installed browsers and extracts cookies (supports Chrome, Firefox, Edge, Brave)
  105. `rdt login` automatically tries all installed browsers and uses the first one with valid cookies.
  106. ### Cookie TTL
  107. Saved cookies are valid for **7 days** by default. After that, the client automatically attempts to refresh from the browser. If browser extraction fails, the existing cookies are used with a warning.
  108. ### Short-Index Navigation
  109. After any listing command such as `feed`, `popular`, `all`, `sub`, or `search`, the CLI stores the latest ordered post list in `~/.config/rdt-cli/index_cache.json`.
  110. - `rdt show <N>` reads the Nth post from the latest listing
  111. - `rdt open <N>` opens the Nth post in the browser
  112. - `rdt upvote <N>`, `rdt save <N>`, `rdt comment <N>` reuse the same short index
  113. - Empty listings clear the index cache, so old results are not reused by accident
  114. ## Environment Variables
  115. | Variable | Default | Description |
  116. |----------|---------|-------------|
  117. | `OUTPUT` | `auto` | Output format: `json`, `yaml`, `rich`, or `auto` (→ YAML when non-TTY) |
  118. ## Rate Limiting & Anti-Detection
  119. rdt-cli includes anti-detection measures designed to minimize risk:
  120. ### Request Timing
  121. - **Gaussian jitter**: Delays between requests use a truncated Gaussian distribution (~1s mean, σ=0.3)
  122. - **Random long pauses**: ~5% of requests include an additional 2-5 second delay simulating reading behavior
  123. - **Auto-retry**: Exponential backoff on HTTP 429/5xx and network errors (up to 3 retries)
  124. ### Browser Fingerprint Consistency
  125. - **UA/Platform alignment**: User-Agent, `sec-ch-ua`, `sec-ch-ua-platform`, `sec-ch-ua-mobile` are all consistent (Chrome 133)
  126. - **Cookie merge**: Set-Cookie headers from Reddit responses are merged back into the session
  127. ## Structured Output
  128. All `--json` / `--yaml` output uses the shared envelope from [SCHEMA.md](./SCHEMA.md):
  129. ```yaml
  130. ok: true
  131. schema_version: "1"
  132. data: { ... }
  133. ```
  134. When stdout is not a TTY (e.g., piped or invoked by an AI agent), output defaults to YAML.
  135. Use `OUTPUT=yaml|json|rich|auto` to override.
  136. ## Use as AI Agent Skill
  137. rdt-cli ships with a [`SKILL.md`](./SKILL.md) that teaches AI agents how to use it.
  138. ### [Skills CLI](https://github.com/vercel-labs/skills) (Recommended)
  139. ```bash
  140. npx skills add jackwener/rdt-cli
  141. ```
  142. | Flag | Description |
  143. | --- | --- |
  144. | `-g` | Install globally (user-level, shared across projects) |
  145. | `-a claude-code` | Target a specific agent |
  146. | `-y` | Non-interactive mode |
  147. ### Manual Install
  148. ```bash
  149. mkdir -p .agents/skills
  150. git clone git@github.com:jackwener/rdt-cli.git .agents/skills/rdt-cli
  151. ```
  152. ### ~~OpenClaw / ClawHub~~ (Deprecated)
  153. > ⚠️ ClawHub 安装方式已过时,不再支持。请使用上方的 [Skills CLI](#skills-cli-recommended) 或手动安装。
  154. ## Project Structure
  155. ```text
  156. rdt_cli/
  157. ├── __init__.py # Version
  158. ├── __main__.py # python -m rdt_cli entry point
  159. ├── cli.py # Click entry point & command registration
  160. ├── client.py # Reddit API client (rate-limit, retry, anti-detection)
  161. ├── auth.py # Cookie authentication + TTL refresh
  162. ├── constants.py # URLs, headers, sort options
  163. ├── exceptions.py # Error hierarchy (6 exception types)
  164. ├── index_cache.py # Short-index cache for show/open commands
  165. └── commands/
  166. ├── _common.py # Shared helpers (envelope, output routing, formatters)
  167. ├── auth.py # login, logout, status, whoami
  168. ├── browse.py # feed, popular, all, sub, sub-info, user, user-posts, user-comments, saved, upvoted, open
  169. ├── post.py # read, show
  170. ├── search.py # search, export
  171. └── social.py # upvote, save, subscribe, comment
  172. ```
  173. ## Development
  174. ```bash
  175. # Install dependencies
  176. uv sync
  177. # Run tests
  178. uv run pytest tests/ -v
  179. # Unit tests only (no network)
  180. uv run pytest tests/ -v -m "not smoke"
  181. # Smoke tests (need cookies)
  182. uv run pytest tests/ -v -m smoke
  183. # Lint
  184. uv run ruff check .
  185. ```
  186. ## Troubleshooting
  187. **Q: `No Reddit cookies found`**
  188. 1. Open any browser and visit https://www.reddit.com/
  189. 2. Log in with your account
  190. 3. Run `rdt login` (auto-detects browser)
  191. **Q: `database is locked`**
  192. Close the browser Cookie database lock — close browser, then retry `rdt login`.
  193. **Q: `Session expired`**
  194. Your cookies have expired. Run `rdt logout && rdt login` to refresh.
  195. **Q: `Rate limited`**
  196. Wait and retry; the built-in exponential backoff handles this automatically.
  197. **Q: Requests are slow**
  198. The built-in Gaussian jitter delay (~1s between requests) is intentional to mimic natural browsing and avoid triggering Reddit's rate limiting.
  199. ---
  200. ## 推荐项目
  201. - [xiaohongshu-cli](https://github.com/jackwener/xiaohongshu-cli) — 小红书搜索、阅读和发帖 CLI
  202. - [twitter-cli](https://github.com/jackwener/twitter-cli) — Twitter/X 时间线、书签和发推 CLI
  203. - [bilibili-cli](https://github.com/jackwener/bilibili-cli) — Bilibili 视频、用户、搜索与动态 CLI
  204. - [discord-cli](https://github.com/jackwener/discord-cli) — Discord 本地优先同步、检索与导出 CLI
  205. - [tg-cli](https://github.com/jackwener/tg-cli) — Telegram 本地优先同步、检索与导出 CLI
  206. ## 功能特性
  207. - 🔐 **认证** — 自动提取浏览器 Cookie,状态检查,用户信息
  208. - 🏠 **浏览** — 首页 Feed、Popular、/r/all、纯订阅 Feed(`--subs-only`)
  209. - 📋 **子版块** — 浏览任意 subreddit(排序/时间过滤),查看子版块信息
  210. - 📰 **帖子** — 阅读帖子和评论树
  211. - 💬 **评论展开** — `--expand-more` 可展开额外评论
  212. - 🔢 **短索引导航** — `rdt show 3` 阅读、`rdt open 3` 浏览器打开
  213. - 🔍 **搜索** — 全文搜索,支持子版块、排序、时间过滤
  214. - 📤 **导出** — 搜索结果导出为 CSV 或 JSON
  215. - 👤 **用户** — 查看用户资料、发帖历史、评论历史、收藏和点赞记录
  216. - ⬆️ **互动** — 点赞/踩、收藏、订阅、评论
  217. - 🛡️ **反风控** — Chrome 133 指纹一致性、高斯抖动延迟、指数退避重试
  218. - 📊 **结构化输出** — `--yaml` / `--json`,非 TTY 默认输出 YAML
  219. - 📦 **稳定 envelope** — 参见 [SCHEMA.md](./SCHEMA.md)
  220. ## 安装
  221. ```bash
  222. # 推荐:uv tool(快速、隔离环境)
  223. uv tool install rdt-cli
  224. # 或者:pipx
  225. pipx install rdt-cli
  226. ```
  227. 升级到最新版本:
  228. ```bash
  229. uv tool upgrade rdt-cli
  230. # 或:pipx upgrade rdt-cli
  231. ```
  232. 从源码安装:
  233. ```bash
  234. git clone git@github.com:jackwener/rdt-cli.git
  235. cd rdt-cli
  236. uv sync
  237. ```
  238. ## 使用示例
  239. ```bash
  240. # 认证
  241. rdt login # 从浏览器提取 Cookie
  242. rdt status # 检查登录状态
  243. rdt whoami # 查看用户资料
  244. rdt logout # 清除缓存的 Cookie
  245. # 浏览
  246. rdt feed # 首页 Feed(需要登录)
  247. rdt feed --subs-only # 纯订阅 Feed(无算法推荐)
  248. rdt feed --subs-only -n 5 --max-subs 10 # 限制每个 sub 帖子数和最大 sub 数
  249. rdt popular # 热门帖子
  250. rdt all # /r/all
  251. rdt sub python # 浏览子版块
  252. rdt sub programming -s top -t week # 排序 + 时间过滤
  253. rdt sub-info python # 子版块信息
  254. rdt user spez # 用户资料
  255. rdt user-posts spez # 用户发帖
  256. rdt user-comments spez # 用户评论
  257. rdt saved # 你的收藏
  258. rdt upvoted # 你的点赞
  259. # 阅读
  260. rdt read 1abc123 # 按 ID 阅读帖子
  261. rdt read 1abc123 --expand-more # 展开更多评论
  262. rdt show 3 # 阅读最近一次列表里的第 3 条
  263. rdt show 3 --expand-more # 展开缓存帖子里的更多评论
  264. rdt open 3 # 在浏览器打开
  265. # 搜索
  266. rdt search "python async" # 全局搜索
  267. rdt search "rust vs go" -r programming # 在子版块内搜索
  268. rdt export "python tips" -n 100 -o tips.csv # 导出
  269. # 互动(需要登录)
  270. rdt upvote 3 # 点赞
  271. rdt save 3 # 收藏
  272. rdt subscribe python # 订阅
  273. rdt comment 3 "Great post!" # 评论
  274. ```
  275. ## 认证策略
  276. rdt-cli 支持浏览器 Cookie 提取来认证 Reddit:
  277. 1. **已保存 Cookie** — 从 `~/.config/rdt-cli/credential.json` 加载
  278. 2. **浏览器 Cookie** — 自动检测已安装浏览器并提取(支持 Chrome、Firefox、Edge、Brave)
  279. Cookie 保存后有效期 **7 天**,超时后自动尝试从浏览器刷新。
  280. ## 常见问题
  281. - `No Reddit cookies found` — 请先在任意浏览器打开 https://www.reddit.com/ 并登录,然后执行 `rdt login`
  282. - `database is locked` — 关闭浏览器后重试
  283. - `Session expired` — Cookie 过期,执行 `rdt logout && rdt login` 刷新
  284. - `Rate limited` — 等待重试,内置指数退避会自动处理
  285. - 请求较慢是正常的 — 内置高斯随机延迟(~1s)是为了模拟人类浏览行为,避免触发限速
  286. ## 作为 AI Agent Skill 使用
  287. rdt-cli 自带 [`SKILL.md`](./SKILL.md),让 AI Agent 能自动学习并使用本工具。
  288. ### [Skills CLI](https://github.com/vercel-labs/skills)(推荐)
  289. ```bash
  290. npx skills add jackwener/rdt-cli
  291. ```
  292. | 参数 | 说明 |
  293. | --- | --- |
  294. | `-g` | 全局安装(用户级别,跨项目共享) |
  295. | `-a claude-code` | 指定目标 Agent |
  296. | `-y` | 非交互模式 |
  297. ### 手动安装
  298. ```bash
  299. mkdir -p .agents/skills
  300. git clone git@github.com:jackwener/rdt-cli.git .agents/skills/rdt-cli
  301. ```
  302. ### ~~OpenClaw / ClawHub~~(已过时)
  303. > ⚠️ ClawHub 安装方式已过时,不再支持。请使用上方的 Skills CLI 或手动安装。
  304. ## License
  305. Apache-2.0

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.