@jackwener/opencli 0.7.0 ā 0.7.3
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/LICENSE +190 -28
- package/README.md +6 -5
- package/README.zh-CN.md +5 -4
- package/SKILL.md +18 -4
- package/dist/browser.js +2 -3
- package/dist/cli-manifest.json +195 -22
- package/dist/clis/linkedin/search.d.ts +1 -0
- package/dist/clis/linkedin/search.js +366 -0
- package/dist/clis/reddit/read.d.ts +1 -0
- package/dist/clis/reddit/read.js +184 -0
- package/dist/clis/youtube/transcript-group.d.ts +44 -0
- package/dist/clis/youtube/transcript-group.js +226 -0
- package/dist/clis/youtube/transcript-group.test.d.ts +1 -0
- package/dist/clis/youtube/transcript-group.test.js +99 -0
- package/dist/clis/youtube/transcript.d.ts +1 -0
- package/dist/clis/youtube/transcript.js +264 -0
- package/dist/clis/youtube/utils.d.ts +8 -0
- package/dist/clis/youtube/utils.js +28 -0
- package/dist/clis/youtube/video.d.ts +1 -0
- package/dist/clis/youtube/video.js +114 -0
- package/dist/engine.js +2 -1
- package/dist/main.js +10 -2
- package/dist/output.js +2 -1
- package/dist/registry.d.ts +1 -8
- package/dist/snapshotFormatter.d.ts +9 -0
- package/dist/snapshotFormatter.js +352 -15
- package/dist/snapshotFormatter.test.d.ts +7 -0
- package/dist/snapshotFormatter.test.js +521 -0
- package/dist/validate.d.ts +14 -2
- package/dist/verify.d.ts +14 -2
- package/package.json +2 -2
- package/src/browser.ts +2 -4
- package/src/clis/linkedin/search.ts +416 -0
- package/src/clis/reddit/read.ts +186 -0
- package/src/clis/youtube/transcript-group.test.ts +108 -0
- package/src/clis/youtube/transcript-group.ts +287 -0
- package/src/clis/youtube/transcript.ts +280 -0
- package/src/clis/youtube/utils.ts +28 -0
- package/src/clis/youtube/video.ts +116 -0
- package/src/engine.ts +4 -1
- package/src/main.ts +10 -2
- package/src/output.ts +2 -1
- package/src/registry.ts +1 -8
- package/src/snapshotFormatter.test.ts +579 -0
- package/src/snapshotFormatter.ts +399 -13
- package/src/validate.ts +19 -4
- package/src/verify.ts +17 -3
- package/vitest.config.ts +15 -1
- package/dist/clis/reddit/read.yaml +0 -76
- package/src/clis/reddit/read.yaml +0 -76
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
site: reddit
|
|
2
|
-
name: read
|
|
3
|
-
description: Read a Reddit post and its comments
|
|
4
|
-
domain: reddit.com
|
|
5
|
-
strategy: cookie
|
|
6
|
-
browser: true
|
|
7
|
-
|
|
8
|
-
args:
|
|
9
|
-
post_id:
|
|
10
|
-
type: string
|
|
11
|
-
required: true
|
|
12
|
-
description: "Post ID (e.g. 1abc123) or full URL"
|
|
13
|
-
sort:
|
|
14
|
-
type: string
|
|
15
|
-
default: best
|
|
16
|
-
description: "Comment sort: best, top, new, controversial, old, qa"
|
|
17
|
-
limit:
|
|
18
|
-
type: int
|
|
19
|
-
default: 25
|
|
20
|
-
description: Number of top-level comments to fetch
|
|
21
|
-
|
|
22
|
-
columns: [type, author, score, text]
|
|
23
|
-
|
|
24
|
-
pipeline:
|
|
25
|
-
- navigate: https://www.reddit.com
|
|
26
|
-
- evaluate: |
|
|
27
|
-
(async () => {
|
|
28
|
-
let postId = ${{ args.post_id | json }};
|
|
29
|
-
const urlMatch = postId.match(/comments\/([a-z0-9]+)/);
|
|
30
|
-
if (urlMatch) postId = urlMatch[1];
|
|
31
|
-
|
|
32
|
-
const sort = ${{ args.sort | json }};
|
|
33
|
-
const limit = ${{ args.limit }};
|
|
34
|
-
const res = await fetch('/comments/' + postId + '.json?sort=' + sort + '&limit=' + limit + '&raw_json=1', {
|
|
35
|
-
credentials: 'include'
|
|
36
|
-
});
|
|
37
|
-
const data = await res.json();
|
|
38
|
-
if (!Array.isArray(data) || data.length < 1) return [];
|
|
39
|
-
|
|
40
|
-
const results = [];
|
|
41
|
-
|
|
42
|
-
// First element: post itself
|
|
43
|
-
const post = data[0]?.data?.children?.[0]?.data;
|
|
44
|
-
if (post) {
|
|
45
|
-
let body = post.selftext || '';
|
|
46
|
-
if (body.length > 2000) body = body.slice(0, 2000) + '\n... [truncated]';
|
|
47
|
-
results.push({
|
|
48
|
-
type: 'š° POST',
|
|
49
|
-
author: post.author,
|
|
50
|
-
score: post.score,
|
|
51
|
-
text: post.title + (body ? '\n\n' + body : '') + (post.url && !post.is_self ? '\nš ' + post.url : ''),
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Second element: comments
|
|
56
|
-
const comments = data[1]?.data?.children || [];
|
|
57
|
-
for (const c of comments) {
|
|
58
|
-
if (c.kind !== 't1') continue;
|
|
59
|
-
const d = c.data;
|
|
60
|
-
let body = d.body || '';
|
|
61
|
-
if (body.length > 500) body = body.slice(0, 500) + '...';
|
|
62
|
-
results.push({
|
|
63
|
-
type: 'š¬ COMMENT',
|
|
64
|
-
author: d.author || '[deleted]',
|
|
65
|
-
score: d.score || 0,
|
|
66
|
-
text: body,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return results;
|
|
71
|
-
})()
|
|
72
|
-
- map:
|
|
73
|
-
type: ${{ item.type }}
|
|
74
|
-
author: ${{ item.author }}
|
|
75
|
-
score: ${{ item.score }}
|
|
76
|
-
text: ${{ item.text }}
|