x-collect-skill 1.0.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  English | [中文](./README.zh-CN.md)
20
20
 
21
- X/Twitter topic intelligence skill for Claude Code. Uses Playwright browser automation to search x.com directly, scraping real tweets with engagement metrics.
21
+ X/Twitter topic intelligence skill for Claude Code. Uses Actionbook browser automation to search x.com directly, scraping real tweets with engagement metrics.
22
22
 
23
23
  ## What it does
24
24
 
@@ -40,13 +40,16 @@ Output: JSONL + Markdown in `./x-collect-data/` with real handles, tweet text, l
40
40
  | Dependency | Purpose | Required |
41
41
  |------------|---------|----------|
42
42
  | [Claude Code](https://claude.ai/claude-code) | Runtime | Yes |
43
- | [Playwright MCP](https://github.com/microsoft/playwright-mcp) | Browser automation | Yes |
44
- | Logged-in X/Twitter session | Browser must have x.com logged in | Yes |
43
+ | [Actionbook CLI](https://actionbook.dev) | Browser automation (`actionbook` command) | Yes |
44
+ | Actionbook Chrome Extension | Controls user's existing Chrome browser | Yes |
45
+ | Logged-in X/Twitter session | Chrome must have x.com logged in | Yes |
45
46
 
46
- ### Install Playwright MCP
47
+ ### Setup Actionbook Extension
47
48
 
48
49
  ```bash
49
- claude mcp add --scope user playwright -- npx @playwright/mcp@latest
50
+ actionbook extension install # install extension files
51
+ # Then load unpacked extension in Chrome (chrome://extensions)
52
+ actionbook extension serve # start bridge (keep running)
50
53
  ```
51
54
 
52
55
  ## Install
@@ -130,14 +133,15 @@ Data saved to `./x-collect-data/`:
130
133
 
131
134
  ## How it works
132
135
 
133
- The skill uses Playwright MCP to:
134
- 1. Navigate to x.com search pages with Top tab and various filters
135
- 2. Wait for tweets to load
136
- 3. Extract tweet data via DOM queries or accessibility tree snapshot
137
- 4. Deduplicate by tweet URL
138
- 5. Output JSONL + Markdown with Content Opportunity Summary
136
+ The skill uses Actionbook Extension mode to:
137
+ 1. Control the user's Chrome browser (with existing x.com login)
138
+ 2. Navigate to x.com search pages with Top tab and various filters
139
+ 3. Wait for tweets to load
140
+ 4. Extract tweet data via JavaScript evaluation
141
+ 5. Deduplicate by tweet URL
142
+ 6. Output JSONL + Markdown with Content Opportunity Summary
139
143
 
140
- No third-party API needed — reads directly from x.com via Playwright browser automation.
144
+ No third-party API needed — reads directly from x.com via Actionbook browser automation.
141
145
 
142
146
  ## Community
143
147
 
package/README.zh-CN.md CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  [English](./README.md) | 中文
20
20
 
21
- X/Twitter 话题情报采集工具,Claude Code 专用 Skill。通过 Playwright 浏览器自动化直接搜索 x.com,抓取真实推文和互动数据。
21
+ X/Twitter 话题情报采集工具,Claude Code 专用 Skill。通过 Actionbook 浏览器自动化直接搜索 x.com,抓取真实推文和互动数据。
22
22
 
23
23
  ## 功能
24
24
 
@@ -40,13 +40,16 @@ X/Twitter 话题情报采集工具,Claude Code 专用 Skill。通过 Playwrigh
40
40
  | 依赖 | 用途 | 必需 |
41
41
  |------|------|------|
42
42
  | [Claude Code](https://claude.ai/claude-code) | 运行环境 | 是 |
43
- | [Playwright MCP](https://github.com/microsoft/playwright-mcp) | 浏览器自动化 | 是 |
44
- | 已登录的 X/Twitter 会话 | 浏览器需已登录 x.com | 是 |
43
+ | [Actionbook CLI](https://actionbook.dev) | 浏览器自动化(`actionbook` 命令) | 是 |
44
+ | Actionbook Chrome 扩展 | 控制用户已有的 Chrome 浏览器 | 是 |
45
+ | 已登录的 X/Twitter 会话 | Chrome 需已登录 x.com | 是 |
45
46
 
46
- ### 安装 Playwright MCP
47
+ ### 安装 Actionbook 扩展
47
48
 
48
49
  ```bash
49
- claude mcp add --scope user playwright -- npx @playwright/mcp@latest
50
+ actionbook extension install # 安装扩展文件
51
+ # 然后在 Chrome 中加载未打包扩展 (chrome://extensions)
52
+ actionbook extension serve # 启动桥接(保持运行)
50
53
  ```
51
54
 
52
55
  ## 安装
@@ -130,14 +133,15 @@ cp x-collect/SKILL.md ~/.claude/skills/x-collect/
130
133
 
131
134
  ## 工作原理
132
135
 
133
- 通过 Playwright MCP 浏览器自动化:
134
- 1. 导航到 x.com 搜索页(Top 标签页 + 各种过滤条件)
135
- 2. 等待推文加载
136
- 3. 通过 DOM 查询或无障碍树快照提取推文数据
137
- 4. 按推文 URL 去重
138
- 5. 输出 JSONL + Markdown,附带内容机会分析
136
+ 通过 Actionbook Extension 模式浏览器自动化:
137
+ 1. 控制用户的 Chrome 浏览器(使用已有的 x.com 登录状态)
138
+ 2. 导航到 x.com 搜索页(Top 标签页 + 各种过滤条件)
139
+ 3. 等待推文加载
140
+ 4. 通过 JavaScript 执行提取推文数据
141
+ 5. 按推文 URL 去重
142
+ 6. 输出 JSONL + Markdown,附带内容机会分析
139
143
 
140
- 无需第三方 API,直接通过 Playwright 浏览器自动化读取 x.com。
144
+ 无需第三方 API,直接通过 Actionbook 浏览器自动化读取 x.com。
141
145
 
142
146
  ## 社区
143
147
 
package/SKILL.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: x-collect
3
3
  description: |
4
- X/Twitter topic intelligence tool. Uses Playwright browser automation to search
4
+ X/Twitter topic intelligence tool. Uses Actionbook browser automation to search
5
5
  x.com directly, scraping real tweets, engagement metrics, and KOL accounts.
6
6
  Outputs a structured intel report (JSONL + Markdown) with content opportunity analysis.
7
7
  Use when the user wants to research a topic on X/Twitter, find what's performing,
@@ -15,20 +15,11 @@ allowed-tools:
15
15
  - Glob
16
16
  - Grep
17
17
  - AskUserQuestion
18
- - mcp__playwright__browser_navigate
19
- - mcp__playwright__browser_snapshot
20
- - mcp__playwright__browser_take_screenshot
21
- - mcp__playwright__browser_run_code
22
- - mcp__playwright__browser_click
23
- - mcp__playwright__browser_type
24
- - mcp__playwright__browser_wait_for
25
- - mcp__playwright__browser_press_key
26
- - mcp__playwright__browser_tabs
27
18
  ---
28
19
 
29
20
  # X Topic Intelligence
30
21
 
31
- Research what's trending and performing on X/Twitter for any topic. Browse x.com directly via Playwright browser automation to find real tweets, engagement data, and KOL accounts.
22
+ Research what's trending and performing on X/Twitter for any topic. Browse x.com directly via Actionbook Extension mode (controlling the user's logged-in Chrome) to find real tweets, engagement data, and KOL accounts.
32
23
 
33
24
  ---
34
25
 
@@ -49,95 +40,87 @@ When no topic is provided, use `AskUserQuestion`:
49
40
  | Dependency | Purpose | Required |
50
41
  |------------|---------|----------|
51
42
  | Claude Code | Runtime | Yes |
52
- | Playwright MCP | Browser automation (`npx @playwright/mcp@latest`) | Yes |
53
- | Logged-in X/Twitter session | Browser must have an active x.com session | Yes |
43
+ | Actionbook CLI | Browser automation (`actionbook` command) | Yes |
44
+ | Actionbook Extension | Chrome extension + bridge for controlling user's browser | Yes |
45
+ | Logged-in X/Twitter session | User's Chrome must have an active x.com session | Yes |
46
+
47
+ ### Pre-flight Check
48
+
49
+ Before starting any round, verify the extension bridge is running:
50
+
51
+ ```bash
52
+ actionbook extension ping
53
+ ```
54
+
55
+ If not connected, inform the user:
56
+ > "Actionbook extension bridge is not running. Please run `actionbook extension serve` in a terminal and ensure the Chrome extension is connected."
54
57
 
55
58
  ---
56
59
 
57
60
  ## Browser Automation Flow
58
61
 
59
- Use Playwright MCP tools to navigate x.com, perform searches, and extract tweet data.
62
+ Use Actionbook Extension mode to control the user's Chrome browser, navigate x.com, perform searches, and extract tweet data.
60
63
 
61
64
  ### General Steps (repeat for each search round)
62
65
 
63
- 1. **Navigate** — `browser_navigate` to the x.com search URL
64
- 2. **Wait** — `browser_wait_for` until tweets appear (wait for text like "Like" or a few seconds)
65
- 3. **Extract** — `browser_run_code` to run Playwright JS that scrapes tweet data from the DOM
66
- 4. **Scroll + Extract more** — if fewer than 10 tweets, scroll down and extract again
66
+ 1. **Navigate** — `actionbook --extension browser goto "<search-url>"` to the x.com search URL
67
+ 2. **Wait** — `sleep 3` then `actionbook --extension browser wait "article[data-testid='tweet']"` until tweets appear
68
+ 3. **Extract** — `actionbook --extension browser eval "<JS>"` to run extraction script
69
+ 4. **Scroll + Extract more** — if fewer than 10 tweets, scroll and extract again
67
70
 
68
71
  ### Tweet Extraction Script
69
72
 
70
- Use `browser_run_code` with this Playwright script to extract tweets:
71
-
72
- ```javascript
73
- async (page) => {
74
- const extractTweets = () => {
75
- const tweets = document.querySelectorAll('article[data-testid="tweet"]');
76
- return Array.from(tweets).slice(0, 20).map(t => {
77
- // Handle
78
- const nameEl = t.querySelector('[data-testid="User-Name"]');
79
- const handleLink = nameEl?.querySelector('a[href^="/"][tabindex="-1"]');
80
- const handle = handleLink?.getAttribute('href')?.replace('/', '') || null;
81
- const displayName = nameEl?.querySelector('a span')?.innerText || null;
82
-
83
- // Text
84
- const text = t.querySelector('[data-testid="tweetText"]')?.innerText || '';
85
-
86
- // Timestamp & link
87
- const timeEl = t.querySelector('time');
88
- const time = timeEl?.getAttribute('datetime') || null;
89
- const tweetLink = timeEl?.closest('a')?.getAttribute('href') || null;
90
-
91
- // Engagement: reply, retweet, like counts + views
92
- const replyCount = t.querySelector('[data-testid="reply"] span')?.innerText || '0';
93
- const retweetCount = t.querySelector('[data-testid="retweet"] span')?.innerText || '0';
94
- const likeCount = t.querySelector('[data-testid="like"] span')?.innerText || '0';
95
- // Views are in an aria-label on the analytics link
96
- const viewsEl = t.querySelector('a[href*="/analytics"]');
97
- const viewsLabel = viewsEl?.getAttribute('aria-label') || '';
98
- const viewsMatch = viewsLabel.match(/([\d,.]+[KMB]?)\s*view/i);
99
- const views = viewsMatch ? viewsMatch[1] : '0';
100
-
101
- return {
102
- handle: handle ? '@' + handle : null,
103
- display_name: displayName,
104
- text: text.substring(0, 200),
105
- posted_at: time,
106
- url: tweetLink ? 'https://x.com' + tweetLink : null,
107
- replies: replyCount,
108
- retweets: retweetCount,
109
- likes: likeCount,
110
- views: views
111
- };
112
- }).filter(t => t.text && t.handle);
113
- };
114
-
115
- // 1. Extract BEFORE scrolling (captures high-engagement first-screen tweets)
116
- const initial = await page.evaluate(extractTweets);
117
-
118
- // 2. Scroll down in steps to load more
119
- for (let i = 0; i < 3; i++) {
120
- await page.evaluate(() => window.scrollBy(0, 1500));
121
- await page.waitForTimeout(1500);
122
- }
123
-
124
- // 3. Extract again after scrolling
125
- const afterScroll = await page.evaluate(extractTweets);
126
-
127
- // 4. Deduplicate by URL
128
- const seen = new Set();
129
- const all = [];
130
- for (const t of [...initial, ...afterScroll]) {
131
- if (t.url && !seen.has(t.url)) {
132
- seen.add(t.url);
133
- all.push(t);
134
- }
135
- }
136
- return all;
137
- }
73
+ Use `actionbook --extension browser eval` with this JS to extract tweets:
74
+
75
+ ```bash
76
+ actionbook --extension browser eval "
77
+ (function() {
78
+ var tweets = document.querySelectorAll('article[data-testid=\"tweet\"]');
79
+ return Array.from(tweets).slice(0, 20).map(function(t) {
80
+ var nameEl = t.querySelector('[data-testid=\"User-Name\"]');
81
+ var handleLink = nameEl ? nameEl.querySelector('a[href^=\"/\"][tabindex=\"-1\"]') : null;
82
+ var handle = handleLink ? handleLink.getAttribute('href').replace('/', '') : null;
83
+ var displayName = nameEl ? (nameEl.querySelector('a span') || {}).innerText || null : null;
84
+ var textEl = t.querySelector('[data-testid=\"tweetText\"]');
85
+ var text = textEl ? textEl.innerText : '';
86
+ var timeEl = t.querySelector('time');
87
+ var time = timeEl ? timeEl.getAttribute('datetime') : null;
88
+ var linkEl = timeEl ? timeEl.closest('a') : null;
89
+ var tweetLink = linkEl ? linkEl.getAttribute('href') : null;
90
+ var replyCount = (t.querySelector('[data-testid=\"reply\"] span') || {}).innerText || '0';
91
+ var retweetCount = (t.querySelector('[data-testid=\"retweet\"] span') || {}).innerText || '0';
92
+ var likeCount = (t.querySelector('[data-testid=\"like\"] span') || {}).innerText || '0';
93
+ var viewsEl = t.querySelector('a[href*=\"/analytics\"]');
94
+ var viewsLabel = viewsEl ? viewsEl.getAttribute('aria-label') || '' : '';
95
+ var viewsMatch = viewsLabel.match(/([\d,.]+[KMB]?)\s*view/i);
96
+ var views = viewsMatch ? viewsMatch[1] : '0';
97
+ return {
98
+ handle: handle ? '@' + handle : null,
99
+ display_name: displayName,
100
+ text: text.substring(0, 200),
101
+ posted_at: time,
102
+ url: tweetLink ? 'https://x.com' + tweetLink : null,
103
+ replies: replyCount, retweets: retweetCount, likes: likeCount, views: views
104
+ };
105
+ }).filter(function(t) { return t.text && t.handle; });
106
+ })()
107
+ "
108
+ ```
109
+
110
+ ### Scrolling to Load More Tweets
111
+
112
+ ```bash
113
+ # Scroll down 1500px, wait, repeat 3 times
114
+ actionbook --extension browser eval "window.scrollBy(0, 1500)"
115
+ sleep 2
116
+ actionbook --extension browser eval "window.scrollBy(0, 1500)"
117
+ sleep 2
118
+ actionbook --extension browser eval "window.scrollBy(0, 1500)"
119
+ sleep 2
120
+ # Then re-run extraction script above and deduplicate by URL
138
121
  ```
139
122
 
140
- > **Note**: X's DOM structure may change. If the selectors break, use `browser_snapshot` to read the accessibility tree and extract data manually, or use `browser_take_screenshot` to visually inspect the page and adjust selectors.
123
+ > **Note**: X's DOM structure may change. If selectors break, use `actionbook --extension browser snapshot` to read the accessibility tree, or `actionbook --extension browser screenshot` to visually inspect and adjust selectors.
141
124
 
142
125
  ---
143
126
 
package/bin/install.js CHANGED
@@ -19,5 +19,8 @@ console.log(`Installed ${SKILL_NAME} skill to ${SKILL_DIR}/SKILL.md`);
19
19
  console.log("");
20
20
  console.log("Usage: /x-collect [topic]");
21
21
  console.log("");
22
- console.log("Prerequisite: Playwright MCP must be configured in Claude Code.");
23
- console.log(" claude mcp add --scope user playwright -- npx @playwright/mcp@latest");
22
+ console.log("Prerequisite: Actionbook CLI and Chrome Extension must be installed.");
23
+ console.log(" 1. Install Actionbook CLI: https://actionbook.dev");
24
+ console.log(" 2. Run: actionbook extension install");
25
+ console.log(" 3. Load unpacked extension in Chrome (chrome://extensions)");
26
+ console.log(" 4. Start bridge: actionbook extension serve");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-collect-skill",
3
- "version": "1.0.2",
3
+ "version": "2.0.0",
4
4
  "description": "X/Twitter topic intelligence skill for Claude Code",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -8,7 +8,7 @@
8
8
  "agent-skill",
9
9
  "twitter",
10
10
  "x-com",
11
- "playwright"
11
+ "actionbook"
12
12
  ],
13
13
  "homepage": "https://github.com/SamCuipogobongo/x-collect",
14
14
  "repository": {