返回 Skill 列表
extension
分类: 数据与分析无需 API Key

X 个人资料抓取器

定时抓取 X 账号资料、近期帖子和外链内容,形成可复盘数据集

person作者: user_c5d41a7dhubcommunity

X 个人资料抓取器

适用场景

定时抓取 X 账号资料、近期帖子和外链内容,形成可复盘数据集。

  • 自动保存目标账号画像,避免信息丢失和手工收集。

功能说明

定时抓取 X 账号资料、近期帖子和外链内容,形成可复盘数据集。

这个 Skill 能帮你做什么

  • 自动保存目标账号画像,避免信息丢失和手工收集。
  • 自动展开短链并补抓标题,提高线索可读性。
  • 统一导出 CSV 与按天归档,方便销售/研究使用。

需要的工具/依赖

| 类型 | 工具/能力 | 用途 | 说明 | |---|---|---|---| | 内置 | web_fetch | 抓取资料页与链接内容 | 内置能力 | | 外部 | web_search | 补充关联信息 | 可替换外部集成 | | 内置 | csv | 输出结构化报表 | 内置能力 | | 内置 | filesystem | 按日期归档抓取结果 | 内置能力 |

快速体验版(先跑一轮)

先抓 3 个账号做验证:

你是我的 AI 自动化助手。
请帮我做“X 个人资料抓取器”的预演版:
1. 读取目标账号列表中的前3个账号。
2. 抓取资料和最近10条帖子。
3. 尝试展开 t.co 链接并提取标题。
4. 输出 CSV 预览和失败项。

稳定自动版(可长期运行)

1) 目标配置 config/x-targets.json

{
  "profiles": [
    { "handle": "elonmusk", "category": "tech", "priority": "high" },
    { "handle": "sama", "category": "ai", "priority": "high" },
    { "handle": " Naval", "category": "philosophy", "priority": "medium" }
  ],
  "schedule": "daily",
  "posts_to_capture": 10,
  "follow_links": true
}

2) 抓取脚本 skills/x-scraper/index.js

const axios = require('axios');
const cheerio = require('cheerio');

async function scrapeProfile(handle) {
  const url = `https://nitter.net/${handle}`; // Or similar proxy
  const html = await web_fetch(url);
  const $ = cheerio.load(html);

  const profile = {
    handle,
    display_name: $('.profile-card-fullname').text(),
    bio: $('.profile-card-bio').text(),
    followers: parseNumber($('.followers .profile-stat-num').text()),
    following: parseNumber($('.following .profile-stat-num').text()),
    posts: []
  };

  $('.timeline-item').slice(0, 10).each((i, el) => {
    const $post = $(el);
    profile.posts.push({
      date: $post.find('.tweet-date').attr('title'),
      content: $post.find('.tweet-content').text(),
      links: $post.find('a').map((i, a) => $(a).attr('href')).get(),
      replies: parseInt($post.find('.icon-comment').next().text()) || 0,
      retweets: parseInt($post.find('.icon-retweet').next().text()) || 0,
      likes: parseInt($post.find('.icon-heart').next().text()) || 0
    });
  });

  return profile;
}

3) 短链展开逻辑

async function expandLinks(posts) {
  for (const post of posts) {
    post.expanded_links = await Promise.all(
      post.links
        .filter(l => l.includes('t.co'))
        .map(async shortUrl => {
          try {
            const full = await resolveRedirect(shortUrl);
            const content = await web_fetch(full);
            return { url: full, title: extractTitle(content) };
          } catch (e) {
            return { url: shortUrl, error: e.message };
          }
        })
    );
  }
  return posts;
}

4) 执行提示词(自动版)

你是我的 AI 自动化助手,请执行“X Profile Scraper”。
请使用 Skills:web_fetch、web_search、csv、filesystem。

每天 06:00:
1. 读取 config/x-targets.json。
2. 抓取账号资料与最近10条帖子。
3. 展开 t.co 链接并抓取标题。
4. 保存到 data/x-profiles/YYYY-MM-DD/。
5. 生成 CSV 摘要。
6. 对 follower 增长 >20% 的账号标记提醒。

限速规则:
- Max 1 request per 5 seconds
- Rotate User-Agent
- Respect robots.txt

5) 调度配置

{
  "schedule": "0 6 * * *",
  "task": "x_profile_scraper",
  "concurrency": 1,
  "delay_between_requests": 5000
}

落地配置建议

  • 先把“X 个人资料抓取器”拆成一次性试跑和长期自动化两种模式。
  • 先固定数据源、刷新频率和输出格式,再逐步加入评分和告警。
  • 建议保留运行日志、输入样例和最终输出,方便后续复盘和交付验收。

验收口径

  • 能用真实或模拟数据完整跑通一次。
  • 输出结果结构清晰,包含下一步动作或明确结论。
  • 抽样核对原始链接、去重结果和最终摘要,确保结论可追溯。

注意事项

  • 正式接入账号、数据源或自动操作前,先确认权限边界。
  • 不要把未经验证的数据直接作为决策结论。
  • 高风险动作建议默认只生成建议或草稿,不直接执行。

质量等级

  • 难度:进阶
  • 风险:中
  • 自动化程度:可定时
  • 适用对象:个人

成功标准

  • 100% of target profiles captured daily
  • Link expansion success > 90%
  • Data archived for 90 days
  • Keyword alerts within 1 hour