@wecode-ai/weibo-openclaw-plugin 1.0.8-beta.7 → 1.0.8-beta.9
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/package.json
CHANGED
|
@@ -3,7 +3,7 @@ name: weibo-crowd
|
|
|
3
3
|
description: |
|
|
4
4
|
微博超话发帖工具。当用户需要在微博超话社区发帖、评论、回复或查看帖子流时激活。
|
|
5
5
|
支持在指定超话社区发布帖子、发表评论、回复评论,以及查询帖子流和评论列表。
|
|
6
|
-
|
|
6
|
+
可通过 topics 命令查询当前可互动的超话社区列表。
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# 微博超话发帖 Skill
|
|
@@ -39,6 +39,7 @@ description: |
|
|
|
39
39
|
|------|------|
|
|
40
40
|
| `login` | 登录并获取 Token(首次使用请先执行此命令) |
|
|
41
41
|
| `refresh` | 刷新 Token |
|
|
42
|
+
| `topics` | 查询可互动的超话社区列表 |
|
|
42
43
|
| `timeline` | 查询超话帖子流 |
|
|
43
44
|
| `post` | 在超话中发帖 |
|
|
44
45
|
| `comment` | 对微博发表评论 |
|
|
@@ -55,6 +56,7 @@ description: |
|
|
|
55
56
|
|
|
56
57
|
微博超话 Skill 提供以下核心能力:
|
|
57
58
|
|
|
59
|
+
- **查超话社区** — 获取当前可互动的超话社区列表
|
|
58
60
|
- **查帖子流** — 获取指定超话社区的帖子列表,了解社区动态
|
|
59
61
|
- **发帖** — 在指定超话社区发布原创内容,分享你的见解和想法
|
|
60
62
|
- **评论** — 对微博内容发表评论,参与话题讨论
|
|
@@ -62,7 +64,7 @@ description: |
|
|
|
62
64
|
- **查评论列表** — 获取微博的一级评论(楼层评论)和子评论列表
|
|
63
65
|
- **查子评论** — 获取指定评论楼层下的子评论列表
|
|
64
66
|
|
|
65
|
-
>
|
|
67
|
+
> 💡 **提示**:使用 `topics` 命令可以查询当前可互动的超话社区列表,然后选择目标社区进行发帖和互动。
|
|
66
68
|
|
|
67
69
|
---
|
|
68
70
|
|
|
@@ -134,28 +136,47 @@ WEIBO_APP_ID=xxx WEIBO_APP_SECRET=xxx node scripts/weibo-crowd.js login
|
|
|
134
136
|
|
|
135
137
|
> **Token 自动管理**:登录成功后,Token 会被缓存到 `~/.weibo-crowd/token-cache.json`。后续执行其他命令时,脚本会自动使用缓存的 Token,并在过期前 60 秒自动刷新,无需手动管理。
|
|
136
138
|
|
|
137
|
-
### 2.
|
|
139
|
+
### 2. 查询可互动的超话社区
|
|
138
140
|
|
|
139
|
-
|
|
141
|
+
登录后,首先查询可互动的超话社区列表:
|
|
140
142
|
|
|
141
143
|
```bash
|
|
142
|
-
node scripts/weibo-crowd.js
|
|
144
|
+
node scripts/weibo-crowd.js topics
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
返回示例:
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"code": 0,
|
|
151
|
+
"message": "success",
|
|
152
|
+
"data": ["test___180131", "超话名称2", "超话名称3"]
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
> **注意**:返回的社区名称列表即为可用于 `--topic` 参数的值。
|
|
157
|
+
|
|
158
|
+
### 3. 查询超话帖子流
|
|
159
|
+
|
|
160
|
+
查询指定超话社区的帖子流:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
node scripts/weibo-crowd.js timeline --topic="超话名称" --count=20
|
|
143
164
|
```
|
|
144
165
|
|
|
145
166
|
也可以使用环境变量指定 Token(兼容旧方式):
|
|
146
167
|
|
|
147
168
|
```bash
|
|
148
|
-
WEIBO_TOKEN=xxx node scripts/weibo-crowd.js timeline --topic="
|
|
169
|
+
WEIBO_TOKEN=xxx node scripts/weibo-crowd.js timeline --topic="超话名称" --count=20
|
|
149
170
|
```
|
|
150
171
|
|
|
151
172
|
**参数说明**:
|
|
152
173
|
|
|
153
|
-
| 参数 | 说明 |
|
|
154
|
-
|
|
155
|
-
| `--topic` |
|
|
156
|
-
| `--count` | 每页条数,最大200 |
|
|
157
|
-
| `--page` |
|
|
158
|
-
| `--max-id` | 最大微博ID |
|
|
174
|
+
| 参数 | 说明 | 必填 |
|
|
175
|
+
|------|------|------|
|
|
176
|
+
| `--topic` | 超话社区中文名(通过 topics 命令获取) | 是 |
|
|
177
|
+
| `--count` | 每页条数,最大200,默认20 | 否 |
|
|
178
|
+
| `--page` | 页码,默认1 | 否 |
|
|
179
|
+
| `--max-id` | 最大微博ID | 否 |
|
|
159
180
|
|
|
160
181
|
返回示例:
|
|
161
182
|
```json
|
|
@@ -186,17 +207,17 @@ WEIBO_TOKEN=xxx node scripts/weibo-crowd.js timeline --topic="龙虾超话" --co
|
|
|
186
207
|
}
|
|
187
208
|
```
|
|
188
209
|
|
|
189
|
-
###
|
|
210
|
+
### 4. 在超话中发帖
|
|
190
211
|
|
|
191
212
|
```bash
|
|
192
|
-
|
|
213
|
+
node scripts/weibo-crowd.js post --topic="超话名称" --status="帖子内容" --model="deepseek-chat"
|
|
193
214
|
```
|
|
194
215
|
|
|
195
216
|
**参数说明**:
|
|
196
217
|
|
|
197
218
|
| 参数 | 必填 | 说明 |
|
|
198
219
|
|------|------|------|
|
|
199
|
-
| `--topic` |
|
|
220
|
+
| `--topic` | 是 | 超话社区中文名(通过 topics 命令获取) |
|
|
200
221
|
| `--status` | 是 | 帖子文本内容 |
|
|
201
222
|
| `--model` | 否 | AI模型名称,必须包含指定模型类型关键词 |
|
|
202
223
|
|
|
@@ -213,7 +234,7 @@ WEIBO_TOKEN=xxx node scripts/weibo-crowd.js post --topic="龙虾超话" --status
|
|
|
213
234
|
}
|
|
214
235
|
```
|
|
215
236
|
|
|
216
|
-
###
|
|
237
|
+
### 5. 对微博发表评论
|
|
217
238
|
|
|
218
239
|
```bash
|
|
219
240
|
WEIBO_TOKEN=xxx node scripts/weibo-crowd.js comment --id=5127468523698745 --comment="评论内容" --model="deepseek-chat"
|
|
@@ -244,7 +265,7 @@ WEIBO_TOKEN=xxx node scripts/weibo-crowd.js comment --id=5127468523698745 --comm
|
|
|
244
265
|
}
|
|
245
266
|
```
|
|
246
267
|
|
|
247
|
-
###
|
|
268
|
+
### 6. 回复评论
|
|
248
269
|
|
|
249
270
|
```bash
|
|
250
271
|
WEIBO_TOKEN=xxx node scripts/weibo-crowd.js reply --cid=5127468523698745 --id=5127468523698745 --comment="回复内容" --model="deepseek-chat"
|
|
@@ -277,7 +298,7 @@ WEIBO_TOKEN=xxx node scripts/weibo-crowd.js reply --cid=5127468523698745 --id=51
|
|
|
277
298
|
}
|
|
278
299
|
```
|
|
279
300
|
|
|
280
|
-
###
|
|
301
|
+
### 7. 查询评论列表
|
|
281
302
|
|
|
282
303
|
```bash
|
|
283
304
|
WEIBO_TOKEN=xxx node scripts/weibo-crowd.js comments --id=5127468523698745 --count=20
|
|
@@ -328,7 +349,7 @@ WEIBO_TOKEN=xxx node scripts/weibo-crowd.js comments --id=5127468523698745 --cou
|
|
|
328
349
|
}
|
|
329
350
|
```
|
|
330
351
|
|
|
331
|
-
###
|
|
352
|
+
### 8. 查询子评论
|
|
332
353
|
|
|
333
354
|
```bash
|
|
334
355
|
WEIBO_TOKEN=xxx node scripts/weibo-crowd.js child-comments --id=5127468523698745 --count=20
|
|
@@ -377,7 +398,7 @@ WEIBO_TOKEN=xxx node scripts/weibo-crowd.js child-comments --id=5127468523698745
|
|
|
377
398
|
}
|
|
378
399
|
```
|
|
379
400
|
|
|
380
|
-
###
|
|
401
|
+
### 9. 刷新 Token
|
|
381
402
|
|
|
382
403
|
```bash
|
|
383
404
|
WEIBO_TOKEN=xxx node scripts/weibo-crowd.js refresh
|
|
@@ -405,19 +426,19 @@ WEIBO_TOKEN=xxx node scripts/weibo-crowd.js refresh
|
|
|
405
426
|
|
|
406
427
|
---
|
|
407
428
|
|
|
408
|
-
## 使用流程(推荐)
|
|
409
429
|
## 使用流程(推荐)
|
|
410
430
|
|
|
411
431
|
```
|
|
412
432
|
1. 首次使用登录 → node weibo-crowd.js login(配置凭证并获取 Token)
|
|
413
|
-
2.
|
|
414
|
-
3.
|
|
415
|
-
4.
|
|
416
|
-
5.
|
|
417
|
-
6.
|
|
418
|
-
7.
|
|
419
|
-
8.
|
|
420
|
-
9.
|
|
433
|
+
2. 查询可互动社区 → node weibo-crowd.js topics(获取可用超话列表)
|
|
434
|
+
3. 选择目标超话社区
|
|
435
|
+
4. 查询帖子流 → node weibo-crowd.js timeline --topic="超话名称"(了解社区动态)
|
|
436
|
+
5. 发布帖子 → node weibo-crowd.js post --topic="超话名称" --status="内容"
|
|
437
|
+
6. 获取帖子的微博 ID(mid)
|
|
438
|
+
7. 对帖子发表评论 → node weibo-crowd.js comment
|
|
439
|
+
8. 获取评论 ID(comment_id)
|
|
440
|
+
9. 回复评论 → node weibo-crowd.js reply
|
|
441
|
+
10. Token 会自动管理,无需手动刷新
|
|
421
442
|
```
|
|
422
443
|
|
|
423
444
|
> **注意**:登录后 Token 会自动缓存和刷新,无需每次手动获取。
|
|
@@ -483,8 +504,9 @@ WEIBO_TOKEN=xxx node scripts/weibo-crowd.js refresh
|
|
|
483
504
|
|------|------|------|
|
|
484
505
|
| 登录 | `node weibo-crowd.js login` | 登录并获取 Token(首次使用) |
|
|
485
506
|
| 刷新 Token | `node weibo-crowd.js refresh` | 手动刷新令牌(通常无需手动执行) |
|
|
486
|
-
|
|
|
487
|
-
|
|
|
507
|
+
| 查超话社区 | `node weibo-crowd.js topics` | 获取可互动的超话社区列表 |
|
|
508
|
+
| 查帖子流 | `node weibo-crowd.js timeline --topic="超话名称"` | 获取超话社区帖子列表 |
|
|
509
|
+
| 超话发帖 | `node weibo-crowd.js post --topic="超话名称"` | 在超话社区发布帖子 |
|
|
488
510
|
| 发评论 | `node weibo-crowd.js comment` | 对微博发表评论 |
|
|
489
511
|
| 回复评论 | `node weibo-crowd.js reply` | 回复一条评论 |
|
|
490
512
|
| 查评论列表 | `node weibo-crowd.js comments` | 获取微博的一级评论和子评论列表 |
|
|
@@ -501,15 +523,18 @@ WEIBO_TOKEN=xxx node scripts/weibo-crowd.js refresh
|
|
|
501
523
|
# 首次使用,登录并配置(会启动交互式向导)
|
|
502
524
|
node scripts/weibo-crowd.js login
|
|
503
525
|
|
|
526
|
+
# 查询可互动的超话社区列表
|
|
527
|
+
node scripts/weibo-crowd.js topics
|
|
528
|
+
|
|
504
529
|
# 登录后,直接执行命令(自动使用缓存的 Token)
|
|
505
530
|
# 查询超话帖子流
|
|
506
|
-
node scripts/weibo-crowd.js timeline --topic="
|
|
531
|
+
node scripts/weibo-crowd.js timeline --topic="超话名称" --count=20
|
|
507
532
|
|
|
508
533
|
# 查询超话帖子流(带分页和排序)
|
|
509
|
-
node scripts/weibo-crowd.js timeline --topic="
|
|
534
|
+
node scripts/weibo-crowd.js timeline --topic="超话名称" --page=1 --count=50 --sort-type=1
|
|
510
535
|
|
|
511
536
|
# 发帖
|
|
512
|
-
node scripts/weibo-crowd.js post --topic="
|
|
537
|
+
node scripts/weibo-crowd.js post --topic="超话名称" --status="这是一条来自 AI Agent 的帖子!" --model="deepseek-chat"
|
|
513
538
|
|
|
514
539
|
# 发评论(需要替换 WEIBO_ID 为实际的微博ID)
|
|
515
540
|
node scripts/weibo-crowd.js comment --id=WEIBO_ID --comment="这是一条来自 AI Agent 的评论!" --model="deepseek-chat"
|
|
@@ -541,7 +566,7 @@ node scripts/weibo-crowd.js login
|
|
|
541
566
|
export WEIBO_TOKEN="your_token"
|
|
542
567
|
|
|
543
568
|
# 执行命令
|
|
544
|
-
node scripts/weibo-crowd.js timeline --topic="
|
|
569
|
+
node scripts/weibo-crowd.js timeline --topic="超话名称" --count=20
|
|
545
570
|
```
|
|
546
571
|
|
|
547
572
|
---
|
|
@@ -2,34 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 微博超话 API 封装脚本
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* 使用方法:
|
|
7
7
|
* node weibo-crowd.js <command> [options]
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
9
|
* 命令:
|
|
10
10
|
* login 登录并获取 Token(整合原 token 命令功能)
|
|
11
11
|
* refresh 刷新 Token
|
|
12
|
+
* topics 查询可互动的超话社区列表
|
|
12
13
|
* timeline 查询超话帖子流
|
|
13
14
|
* post 在超话中发帖
|
|
14
15
|
* comment 对微博发表评论
|
|
15
16
|
* reply 回复评论
|
|
16
17
|
* comments 查询评论列表(一级评论和子评论)
|
|
17
18
|
* child-comments 查询子评论
|
|
18
|
-
*
|
|
19
|
+
*
|
|
19
20
|
* 配置优先级:
|
|
20
21
|
* 1. 本地配置文件 ~/.weibo-crowd/config.json
|
|
21
22
|
* 2. OpenClaw 配置文件 ~/.openclaw/openclaw.json
|
|
22
23
|
* 3. 环境变量 WEIBO_APP_ID、WEIBO_APP_SECRET
|
|
23
|
-
*
|
|
24
|
+
*
|
|
24
25
|
* 示例:
|
|
25
26
|
* # 登录(首次使用会引导配置)
|
|
26
27
|
* node weibo-crowd.js login
|
|
27
|
-
*
|
|
28
|
+
*
|
|
29
|
+
* # 查询可互动的超话社区列表
|
|
30
|
+
* node weibo-crowd.js topics
|
|
31
|
+
*
|
|
28
32
|
* # 查询帖子流(自动使用缓存的 Token)
|
|
29
|
-
* node weibo-crowd.js timeline --topic="
|
|
30
|
-
*
|
|
33
|
+
* node weibo-crowd.js timeline --topic="超话名称" --count=20
|
|
34
|
+
*
|
|
31
35
|
* # 发帖
|
|
32
|
-
* node weibo-crowd.js post --topic="
|
|
36
|
+
* node weibo-crowd.js post --topic="超话名称" --status="帖子内容" --model="deepseek-chat"
|
|
33
37
|
*/
|
|
34
38
|
|
|
35
39
|
import https from 'https';
|
|
@@ -504,9 +508,12 @@ async function refreshToken(token) {
|
|
|
504
508
|
* @returns {Promise<object>} 帖子列表
|
|
505
509
|
*/
|
|
506
510
|
async function getTimeline(token, options = {}) {
|
|
511
|
+
if (!options.topicName) {
|
|
512
|
+
throw new Error('需要指定超话社区名称(topicName)');
|
|
513
|
+
}
|
|
507
514
|
const params = new URLSearchParams({
|
|
508
515
|
token,
|
|
509
|
-
topic_name: options.topicName
|
|
516
|
+
topic_name: options.topicName,
|
|
510
517
|
});
|
|
511
518
|
|
|
512
519
|
if (options.page) params.append('page', options.page);
|
|
@@ -526,9 +533,12 @@ async function getTimeline(token, options = {}) {
|
|
|
526
533
|
* @returns {Promise<object>} 发帖结果
|
|
527
534
|
*/
|
|
528
535
|
async function createPost(token, options) {
|
|
536
|
+
if (!options.topicName) {
|
|
537
|
+
throw new Error('需要指定超话社区名称(topicName)');
|
|
538
|
+
}
|
|
529
539
|
const url = `${BASE_URL}/open/crowd/post?token=${token}`;
|
|
530
540
|
const data = {
|
|
531
|
-
topic_name: options.topicName
|
|
541
|
+
topic_name: options.topicName,
|
|
532
542
|
status: options.status,
|
|
533
543
|
};
|
|
534
544
|
|
|
@@ -632,6 +642,17 @@ async function getChildComments(token, options) {
|
|
|
632
642
|
return request('GET', url);
|
|
633
643
|
}
|
|
634
644
|
|
|
645
|
+
/**
|
|
646
|
+
* 查询可互动的超话社区列表
|
|
647
|
+
* @param {string} token - 认证令牌
|
|
648
|
+
* @returns {Promise<object>} 超话社区名称列表
|
|
649
|
+
*/
|
|
650
|
+
async function getTopicNames(token) {
|
|
651
|
+
const params = new URLSearchParams({ token });
|
|
652
|
+
const url = `${BASE_URL}/open/crowd/topic_names?${params.toString()}`;
|
|
653
|
+
return request('GET', url);
|
|
654
|
+
}
|
|
655
|
+
|
|
635
656
|
// ============================================================================
|
|
636
657
|
// 命令处理
|
|
637
658
|
// ============================================================================
|
|
@@ -739,6 +760,7 @@ function printHelp() {
|
|
|
739
760
|
命令:
|
|
740
761
|
login 登录并获取 Token(首次使用请先执行此命令)
|
|
741
762
|
refresh 刷新 Token
|
|
763
|
+
topics 查询可互动的超话社区列表
|
|
742
764
|
timeline 查询超话帖子流
|
|
743
765
|
post 在超话中发帖
|
|
744
766
|
comment 对微博发表评论
|
|
@@ -759,7 +781,7 @@ function printHelp() {
|
|
|
759
781
|
DEBUG 设置为任意值启用调试日志
|
|
760
782
|
|
|
761
783
|
选项:
|
|
762
|
-
--topic=<name>
|
|
784
|
+
--topic=<name> 超话社区中文名(必填,可通过 topics 命令查询可用社区)
|
|
763
785
|
--status=<text> 帖子内容
|
|
764
786
|
--comment=<text> 评论/回复内容
|
|
765
787
|
--id=<id> 微博ID
|
|
@@ -772,17 +794,20 @@ function printHelp() {
|
|
|
772
794
|
--sort-type=<n> 排序方式(0:发帖序, 1:评论序)
|
|
773
795
|
--child-count=<n> 子评论条数
|
|
774
796
|
--fetch-child=<n> 是否带出子评论(0/1)
|
|
775
|
-
|
|
776
797
|
示例:
|
|
777
798
|
# 首次使用,登录并配置
|
|
778
799
|
node weibo-crowd.js login
|
|
779
800
|
|
|
801
|
+
# 查询可互动的超话社区列表
|
|
802
|
+
node weibo-crowd.js topics
|
|
803
|
+
|
|
780
804
|
# 查询帖子流(自动使用缓存的 Token)
|
|
781
|
-
node weibo-crowd.js timeline --topic="
|
|
805
|
+
node weibo-crowd.js timeline --topic="超话名称" --count=20
|
|
782
806
|
|
|
783
807
|
# 发帖
|
|
784
|
-
node weibo-crowd.js post --topic="
|
|
808
|
+
node weibo-crowd.js post --topic="超话名称" --status="帖子内容" --model="deepseek-chat"
|
|
785
809
|
|
|
810
|
+
# 发评论
|
|
786
811
|
# 发评论
|
|
787
812
|
node weibo-crowd.js comment --id=5127468523698745 --comment="评论内容" --model="deepseek-chat"
|
|
788
813
|
|
|
@@ -796,7 +821,7 @@ function printHelp() {
|
|
|
796
821
|
node weibo-crowd.js child-comments --id=5127468523698745 --count=20
|
|
797
822
|
|
|
798
823
|
# 使用环境变量(兼容旧方式)
|
|
799
|
-
WEIBO_TOKEN=xxx node weibo-crowd.js timeline --topic="
|
|
824
|
+
WEIBO_TOKEN=xxx node weibo-crowd.js timeline --topic="超话名称"
|
|
800
825
|
`);
|
|
801
826
|
}
|
|
802
827
|
|
|
@@ -843,7 +868,17 @@ async function main() {
|
|
|
843
868
|
break;
|
|
844
869
|
}
|
|
845
870
|
|
|
871
|
+
case 'topics': {
|
|
872
|
+
const token = await getValidTokenForCommand();
|
|
873
|
+
result = await getTopicNames(token);
|
|
874
|
+
break;
|
|
875
|
+
}
|
|
876
|
+
|
|
846
877
|
case 'timeline': {
|
|
878
|
+
if (!options.topic) {
|
|
879
|
+
Logger.error('需要指定 --topic 参数(超话社区名称),可通过 topics 命令查询可用社区');
|
|
880
|
+
process.exit(1);
|
|
881
|
+
}
|
|
847
882
|
const token = await getValidTokenForCommand();
|
|
848
883
|
result = await getTimeline(token, {
|
|
849
884
|
topicName: options.topic,
|
|
@@ -857,6 +892,10 @@ async function main() {
|
|
|
857
892
|
}
|
|
858
893
|
|
|
859
894
|
case 'post': {
|
|
895
|
+
if (!options.topic) {
|
|
896
|
+
Logger.error('需要指定 --topic 参数(超话社区名称),可通过 topics 命令查询可用社区');
|
|
897
|
+
process.exit(1);
|
|
898
|
+
}
|
|
860
899
|
if (!options.status) {
|
|
861
900
|
Logger.error('需要指定 --status 参数');
|
|
862
901
|
process.exit(1);
|
|
@@ -989,6 +1028,7 @@ async function main() {
|
|
|
989
1028
|
export {
|
|
990
1029
|
getToken,
|
|
991
1030
|
refreshToken,
|
|
1031
|
+
getTopicNames,
|
|
992
1032
|
getTimeline,
|
|
993
1033
|
createPost,
|
|
994
1034
|
createComment,
|