Agent Skillsleamsigc/ShortsGenerator › reddit-research-scrape

reddit-research-scrape

GitHub

从Reddit抓取帖子数据并生成病毒式视频脚本。通过JSON API获取准确指标,调用后端API生成西班牙语脚本,输出结构化Markdown和索引文件。

skills/reddit-research-scrape/SKILL.md leamsigc/ShortsGenerator

Trigger Scenarios

需要分析Reddit帖子热度 为Reddit内容生成短视频脚本 批量采集Reddit社区数据

Install

npx skills add leamsigc/ShortsGenerator --skill reddit-research-scrape -g -y
More Options

Use without installing

npx skills use leamsigc/ShortsGenerator@reddit-research-scrape

指定 Agent (Claude Code)

npx skills add leamsigc/ShortsGenerator --skill reddit-research-scrape -a claude-code -g -y

安装 repo 全部 skill

npx skills add leamsigc/ShortsGenerator --all -g -y

预览 repo 内 skill

npx skills add leamsigc/ShortsGenerator --list

SKILL.md

Frontmatter
{
    "name": "reddit-research-scrape",
    "version": "3.0.0",
    "description": "Scrape state — runs the Reddit JSON API scraper for correct data (upvotes,\ncomment counts, full comment trees, exact selftext), then generates a viral\nvideo script per post from the post content + top comments via the backend\nAPI. Saves structured markdown files + index.json.\n",
    "allowed-tools": [
        "Bash",
        "Read",
        "Write",
        "ChromeDevTools"
    ]
}

Reddit Research — Scrape State (v3)

Scrapes top posts from a subreddit with correct upvotes/comment counts using Reddit's JSON API, then generates a viral video script per post.

Before running

Ensure the Flask backend is running on port 8080 (for script generation): curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/api/models

Run

node "$CLAUDE_SKILL_ROOT/scripts/scrape.js" <subreddit> [limit] [sort] [lang] [--session <id>] [--data-root <path>]
# fallback: node ./skills/reddit-research/scripts/scrape.js <subreddit> ...

Defaults: limit=10, sort=hot, lang=es (Spanish).

What the script does

  1. Fetches the subreddit listing JSON: https://www.reddit.com/r/<sub>/<sort>.json?limit=<n>
  2. For each post, fetches <permalink>.json for correct data:
    • Accurate upvotes (not the HTML bug showing 1)
    • Accurate comment counts, full comment trees with correct scores
    • Exact selftext, video URL (media.reddit_video.fallback_url), linked URL
  3. Extracts the top 10 comments (depth ≤ 2)
  4. Generates a viral video script via the backend API (title + content + top comments), ~30-60s
  5. Writes .reddit-research/<YYYY-MM-DD_HHMMSS>/<post-slug>.md (dated session) with:
    • # Title, author, upvotes, comments, source, scraped date
    • ## Content, ## Viral Video Script (Spanish), ## Videos, ## Sourced Videos (placeholder), ## Top Comments
  6. Writes index.json (posts[] with index/title/file/url/upvotes/comments)

Manual fallback (Chrome DevTools CLI)

If the JSON API is blocked, scrape the listing page manually:

  1. chrome-devtools navigate_page --url "https://www.reddit.com/r/<subreddit>/<sort>/" — scroll to load more posts
  2. Extract post URLs from a[href*="/comments/"]
  3. Fetch each post's data via fetch("<post_url>.json") in evaluate_script
  4. Write the same markdown + index.json structure

Key points

Issue HTML scrape JSON API
Upvotes Often 1 Correct count
Comment count Missing Correct count
Comments Author/score missing All fields present

Errors

If a post's JSON API errors (deleted/private/NSFW), log it, skip to the next post, and note the failure in index.json.

Version History

  • 7b83166 Current 2026-08-29 02:31

Same Skill Collection

skills/facebook-research-analyze/SKILL.md
skills/facebook-research-engage/SKILL.md
skills/facebook-research-report/SKILL.md
skills/facebook-research-scrape/SKILL.md
skills/facebook-research-setup/SKILL.md
skills/facebook-research/facebook-research-template/SKILL.md
skills/ig-research-analyze/SKILL.md
skills/ig-research-report/SKILL.md
skills/ig-research-scrape/SKILL.md
skills/ig-research-setup/SKILL.md
skills/ig-research-transcribe/SKILL.md
skills/ig-research/SKILL.md
skills/list-workflows/SKILL.md
skills/new-workflow/SKILL.md
skills/onboard/SKILL.md
skills/reddit-research-generate/SKILL.md
skills/reddit-research/SKILL.md
skills/short-generator/SKILL.md
skills/twitter-research-analyze/SKILL.md
skills/twitter-research-report/SKILL.md
skills/twitter-research-scrape/SKILL.md
skills/twitter-research-setup/SKILL.md
skills/twitter-research-topics/SKILL.md
skills/workflow-conventions/SKILL.md
skills/facebook-research-grow/SKILL.md
skills/facebook-research/SKILL.md
skills/twitter-research/SKILL.md

Metadata

Files
0
Version
7b83166
Hash
4bfb4dd0
Indexed
2026-08-29 02:31

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-30 02:56
浙ICP备14020137号-1 $Carte des visiteurs$