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 +16 -12
- package/README.zh-CN.md +16 -12
- package/SKILL.md +70 -87
- package/bin/install.js +5 -2
- package/package.json +2 -2
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
|
|
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
|
-
| [
|
|
44
|
-
|
|
|
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
|
-
###
|
|
47
|
+
### Setup Actionbook Extension
|
|
47
48
|
|
|
48
49
|
```bash
|
|
49
|
-
|
|
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
|
|
134
|
-
1.
|
|
135
|
-
2.
|
|
136
|
-
3.
|
|
137
|
-
4.
|
|
138
|
-
5.
|
|
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
|
|
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。通过
|
|
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
|
-
| [
|
|
44
|
-
|
|
|
43
|
+
| [Actionbook CLI](https://actionbook.dev) | 浏览器自动化(`actionbook` 命令) | 是 |
|
|
44
|
+
| Actionbook Chrome 扩展 | 控制用户已有的 Chrome 浏览器 | 是 |
|
|
45
|
+
| 已登录的 X/Twitter 会话 | Chrome 需已登录 x.com | 是 |
|
|
45
46
|
|
|
46
|
-
### 安装
|
|
47
|
+
### 安装 Actionbook 扩展
|
|
47
48
|
|
|
48
49
|
```bash
|
|
49
|
-
|
|
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
|
-
通过
|
|
134
|
-
1.
|
|
135
|
-
2.
|
|
136
|
-
3.
|
|
137
|
-
4.
|
|
138
|
-
5.
|
|
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,直接通过
|
|
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
|
|
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
|
|
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
|
-
|
|
|
53
|
-
|
|
|
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
|
|
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** — `
|
|
64
|
-
2. **Wait** — `
|
|
65
|
-
3. **Extract** — `
|
|
66
|
-
4. **Scroll + Extract more** — if fewer than 10 tweets, scroll
|
|
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 `
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
|
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:
|
|
23
|
-
console.log("
|
|
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": "
|
|
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
|
-
"
|
|
11
|
+
"actionbook"
|
|
12
12
|
],
|
|
13
13
|
"homepage": "https://github.com/SamCuipogobongo/x-collect",
|
|
14
14
|
"repository": {
|