thepopebot 1.2.72-beta.2 → 1.2.72-beta.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/lib/chat/components/swarm-page.js +25 -24
- package/lib/chat/components/swarm-page.jsx +12 -13
- package/package.json +1 -1
- package/templates/pi-skills/gccli/SKILL.md +0 -64
- package/templates/pi-skills/gdcli/SKILL.md +0 -101
- package/templates/pi-skills/gmcli/SKILL.md +0 -58
- package/templates/pi-skills/transcribe/SKILL.md +0 -39
- package/templates/pi-skills/transcribe/transcribe.sh +0 -31
- package/templates/pi-skills/vscode/SKILL.md +0 -48
- package/templates/pi-skills/youtube-transcript/SKILL.md +0 -41
- package/templates/pi-skills/youtube-transcript/package.json +0 -8
- package/templates/pi-skills/youtube-transcript/transcript.js +0 -44
|
@@ -42,30 +42,31 @@ function SwarmWorkflowList({ runs }) {
|
|
|
42
42
|
const isActive = run.status === "in_progress" || run.status === "queued";
|
|
43
43
|
const isRunning = run.status === "in_progress";
|
|
44
44
|
const isQueued = run.status === "queued";
|
|
45
|
-
return /* @__PURE__ */ jsxs(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
children: "View"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
45
|
+
return /* @__PURE__ */ jsxs(
|
|
46
|
+
"a",
|
|
47
|
+
{
|
|
48
|
+
href: run.html_url,
|
|
49
|
+
target: "_blank",
|
|
50
|
+
rel: "noopener noreferrer",
|
|
51
|
+
className: "flex items-center gap-3 py-3 px-2 -mx-2 rounded-md hover:bg-accent transition-colors no-underline text-inherit",
|
|
52
|
+
children: [
|
|
53
|
+
isRunning && /* @__PURE__ */ jsx("span", { className: "inline-block h-2.5 w-2.5 shrink-0 rounded-full bg-green-500 animate-pulse" }),
|
|
54
|
+
isQueued && /* @__PURE__ */ jsx("span", { className: "inline-block h-2.5 w-2.5 shrink-0 rounded-full bg-yellow-500" }),
|
|
55
|
+
!isActive && /* @__PURE__ */ jsx(
|
|
56
|
+
"span",
|
|
57
|
+
{
|
|
58
|
+
className: `inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium uppercase shrink-0 ${conclusionBadgeStyles[run.conclusion] || "bg-muted text-muted-foreground"}`,
|
|
59
|
+
children: run.conclusion || "unknown"
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium truncate", children: run.workflow_name || run.branch }),
|
|
63
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground shrink-0", children: isActive ? formatDuration(run.duration_seconds) : timeAgo(run.updated_at || run.started_at) }),
|
|
64
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1" }),
|
|
65
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-blue-500 shrink-0", children: "View" })
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
run.run_id
|
|
69
|
+
);
|
|
69
70
|
}) });
|
|
70
71
|
}
|
|
71
72
|
function SwarmPage({ session }) {
|
|
@@ -70,7 +70,13 @@ function SwarmWorkflowList({ runs }) {
|
|
|
70
70
|
const isQueued = run.status === 'queued';
|
|
71
71
|
|
|
72
72
|
return (
|
|
73
|
-
<
|
|
73
|
+
<a
|
|
74
|
+
key={run.run_id}
|
|
75
|
+
href={run.html_url}
|
|
76
|
+
target="_blank"
|
|
77
|
+
rel="noopener noreferrer"
|
|
78
|
+
className="flex items-center gap-3 py-3 px-2 -mx-2 rounded-md hover:bg-accent transition-colors no-underline text-inherit"
|
|
79
|
+
>
|
|
74
80
|
{/* Status indicator */}
|
|
75
81
|
{isRunning && (
|
|
76
82
|
<span className="inline-block h-2.5 w-2.5 shrink-0 rounded-full bg-green-500 animate-pulse" />
|
|
@@ -103,18 +109,11 @@ function SwarmWorkflowList({ runs }) {
|
|
|
103
109
|
{/* Spacer */}
|
|
104
110
|
<div className="flex-1" />
|
|
105
111
|
|
|
106
|
-
{/* Link */}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
rel="noopener noreferrer"
|
|
112
|
-
className="text-xs text-blue-500 hover:underline shrink-0"
|
|
113
|
-
>
|
|
114
|
-
View
|
|
115
|
-
</a>
|
|
116
|
-
)}
|
|
117
|
-
</div>
|
|
112
|
+
{/* Link label */}
|
|
113
|
+
<span className="text-xs text-blue-500 shrink-0">
|
|
114
|
+
View
|
|
115
|
+
</span>
|
|
116
|
+
</a>
|
|
118
117
|
);
|
|
119
118
|
})}
|
|
120
119
|
</div>
|
package/package.json
CHANGED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gccli
|
|
3
|
-
description: Google Calendar CLI for listing calendars, viewing/creating/updating events, and checking availability.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Google Calendar CLI
|
|
7
|
-
|
|
8
|
-
Command-line interface for Google Calendar operations.
|
|
9
|
-
|
|
10
|
-
## Installation
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
npm install -g @mariozechner/gccli
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Setup
|
|
17
|
-
|
|
18
|
-
### Google Cloud Console (one-time)
|
|
19
|
-
|
|
20
|
-
1. [Create a new project](https://console.cloud.google.com/projectcreate) (or select existing)
|
|
21
|
-
2. [Enable the Google Calendar API](https://console.cloud.google.com/apis/api/calendar-json.googleapis.com)
|
|
22
|
-
3. [Set app name](https://console.cloud.google.com/auth/branding) in OAuth branding
|
|
23
|
-
4. [Add test users](https://console.cloud.google.com/auth/audience) (all Gmail addresses you want to use)
|
|
24
|
-
5. [Create OAuth client](https://console.cloud.google.com/auth/clients):
|
|
25
|
-
- Click "Create Client"
|
|
26
|
-
- Application type: "Desktop app"
|
|
27
|
-
- Download the JSON file
|
|
28
|
-
|
|
29
|
-
### Configure gccli
|
|
30
|
-
|
|
31
|
-
First check if already configured:
|
|
32
|
-
```bash
|
|
33
|
-
gccli accounts list
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
If no accounts, guide the user through setup:
|
|
37
|
-
1. Ask if they have a Google Cloud project with Calendar API enabled
|
|
38
|
-
2. If not, walk them through the Google Cloud Console steps above
|
|
39
|
-
3. Have them download the OAuth credentials JSON
|
|
40
|
-
4. Run: `gccli accounts credentials ~/path/to/credentials.json`
|
|
41
|
-
5. Run: `gccli accounts add <email>` (use `--manual` for browserless OAuth)
|
|
42
|
-
|
|
43
|
-
## Usage
|
|
44
|
-
|
|
45
|
-
Run `gccli --help` for full command reference.
|
|
46
|
-
|
|
47
|
-
Common operations:
|
|
48
|
-
- `gccli <email> calendars` - List all calendars
|
|
49
|
-
- `gccli <email> events <calendarId> [--from <dt>] [--to <dt>]` - List events
|
|
50
|
-
- `gccli <email> event <calendarId> <eventId>` - Get event details
|
|
51
|
-
- `gccli <email> create <calendarId> --summary <s> --start <dt> --end <dt>` - Create event
|
|
52
|
-
- `gccli <email> freebusy <calendarIds> --from <dt> --to <dt>` - Check availability
|
|
53
|
-
|
|
54
|
-
Use `primary` as calendarId for the main calendar.
|
|
55
|
-
|
|
56
|
-
## Date/Time Format
|
|
57
|
-
|
|
58
|
-
- Timed events: `YYYY-MM-DDTHH:MM:SSZ` (UTC) or `YYYY-MM-DDTHH:MM:SS` (local)
|
|
59
|
-
- All-day events: `YYYY-MM-DD` with `--all-day` flag
|
|
60
|
-
|
|
61
|
-
## Data Storage
|
|
62
|
-
|
|
63
|
-
- `~/.gccli/credentials.json` - OAuth client credentials
|
|
64
|
-
- `~/.gccli/accounts.json` - Account tokens
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gdcli
|
|
3
|
-
description: Google Drive CLI for listing, searching, uploading, downloading, and sharing files and folders.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Google Drive CLI
|
|
7
|
-
|
|
8
|
-
Command-line interface for Google Drive operations.
|
|
9
|
-
|
|
10
|
-
## Installation
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
npm install -g @mariozechner/gdcli
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Setup
|
|
17
|
-
|
|
18
|
-
### Google Cloud Console (one-time)
|
|
19
|
-
|
|
20
|
-
1. [Create a new project](https://console.cloud.google.com/projectcreate) (or select existing)
|
|
21
|
-
2. [Enable the Google Drive API](https://console.cloud.google.com/apis/api/drive.googleapis.com)
|
|
22
|
-
3. [Set app name](https://console.cloud.google.com/auth/branding) in OAuth branding
|
|
23
|
-
4. [Add test users](https://console.cloud.google.com/auth/audience) (all Gmail addresses you want to use)
|
|
24
|
-
5. [Create OAuth client](https://console.cloud.google.com/auth/clients):
|
|
25
|
-
- Click "Create Client"
|
|
26
|
-
- Application type: "Desktop app"
|
|
27
|
-
- Download the JSON file
|
|
28
|
-
|
|
29
|
-
### Configure gdcli
|
|
30
|
-
|
|
31
|
-
First check if already configured:
|
|
32
|
-
```bash
|
|
33
|
-
gdcli accounts list
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
If no accounts, guide the user through setup:
|
|
37
|
-
1. Ask if they have a Google Cloud project with Drive API enabled
|
|
38
|
-
2. If not, walk them through the Google Cloud Console steps above
|
|
39
|
-
3. Have them download the OAuth credentials JSON
|
|
40
|
-
4. Run: `gdcli accounts credentials ~/path/to/credentials.json`
|
|
41
|
-
5. Run: `gdcli accounts add <email>` (use `--manual` for browserless OAuth)
|
|
42
|
-
|
|
43
|
-
## Usage
|
|
44
|
-
|
|
45
|
-
Run `gdcli --help` for full command reference.
|
|
46
|
-
|
|
47
|
-
Common operations:
|
|
48
|
-
- `gdcli <email> ls [folderId]` - List files/folders
|
|
49
|
-
- `gdcli <email> ls --query "<query>"` - List with Drive query filter
|
|
50
|
-
- `gdcli <email> search "<text>"` - Full-text content search
|
|
51
|
-
- `gdcli <email> download <fileId> [destPath]` - Download a file
|
|
52
|
-
- `gdcli <email> upload <localPath> [--folder <folderId>]` - Upload a file
|
|
53
|
-
- `gdcli <email> mkdir <name>` - Create a folder
|
|
54
|
-
- `gdcli <email> share <fileId> --anyone` - Share publicly
|
|
55
|
-
|
|
56
|
-
## Search
|
|
57
|
-
|
|
58
|
-
**Two different commands:**
|
|
59
|
-
- `search "<text>"` - Searches inside file contents (fullText)
|
|
60
|
-
- `ls --query "<query>"` - Filters by metadata (name, type, date, etc.)
|
|
61
|
-
|
|
62
|
-
**Use `ls --query` for filename searches!**
|
|
63
|
-
|
|
64
|
-
## Query Syntax (for ls --query)
|
|
65
|
-
|
|
66
|
-
Format: `field operator value`. Combine with `and`/`or`, group with `()`.
|
|
67
|
-
|
|
68
|
-
**Operators:** `=`, `!=`, `contains`, `<`, `>`, `<=`, `>=`
|
|
69
|
-
|
|
70
|
-
**Examples:**
|
|
71
|
-
```bash
|
|
72
|
-
# By filename
|
|
73
|
-
ls --query "name = 'report.pdf'" # exact match
|
|
74
|
-
ls --query "name contains 'IMG'" # prefix match
|
|
75
|
-
|
|
76
|
-
# By type
|
|
77
|
-
ls --query "mimeType = 'application/pdf'"
|
|
78
|
-
ls --query "mimeType contains 'image/'"
|
|
79
|
-
ls --query "mimeType = 'application/vnd.google-apps.folder'" # folders
|
|
80
|
-
|
|
81
|
-
# By date
|
|
82
|
-
ls --query "modifiedTime > '2024-01-01'"
|
|
83
|
-
|
|
84
|
-
# By owner/sharing
|
|
85
|
-
ls --query "'me' in owners"
|
|
86
|
-
ls --query "sharedWithMe"
|
|
87
|
-
|
|
88
|
-
# Exclude trash
|
|
89
|
-
ls --query "trashed = false"
|
|
90
|
-
|
|
91
|
-
# Combined
|
|
92
|
-
ls --query "name contains 'report' and mimeType = 'application/pdf'"
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
Ref: https://developers.google.com/drive/api/guides/ref-search-terms
|
|
96
|
-
|
|
97
|
-
## Data Storage
|
|
98
|
-
|
|
99
|
-
- `~/.gdcli/credentials.json` - OAuth client credentials
|
|
100
|
-
- `~/.gdcli/accounts.json` - Account tokens
|
|
101
|
-
- `~/.gdcli/downloads/` - Default download location
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: gmcli
|
|
3
|
-
description: Gmail CLI for searching emails, reading threads, sending messages, managing drafts, and handling labels/attachments.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Gmail CLI
|
|
7
|
-
|
|
8
|
-
Command-line interface for Gmail operations.
|
|
9
|
-
|
|
10
|
-
## Installation
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
npm install -g @mariozechner/gmcli
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Setup
|
|
17
|
-
|
|
18
|
-
### Google Cloud Console (one-time)
|
|
19
|
-
|
|
20
|
-
1. [Create a new project](https://console.cloud.google.com/projectcreate) (or select existing)
|
|
21
|
-
2. [Enable the Gmail API](https://console.cloud.google.com/apis/api/gmail.googleapis.com)
|
|
22
|
-
3. [Set app name](https://console.cloud.google.com/auth/branding) in OAuth branding
|
|
23
|
-
4. [Add test users](https://console.cloud.google.com/auth/audience) (all Gmail addresses you want to use)
|
|
24
|
-
5. [Create OAuth client](https://console.cloud.google.com/auth/clients):
|
|
25
|
-
- Click "Create Client"
|
|
26
|
-
- Application type: "Desktop app"
|
|
27
|
-
- Download the JSON file
|
|
28
|
-
|
|
29
|
-
### Configure gmcli
|
|
30
|
-
|
|
31
|
-
First check if already configured:
|
|
32
|
-
```bash
|
|
33
|
-
gmcli accounts list
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
If no accounts, guide the user through setup:
|
|
37
|
-
1. Ask if they have a Google Cloud project with Gmail API enabled
|
|
38
|
-
2. If not, walk them through the Google Cloud Console steps above
|
|
39
|
-
3. Have them download the OAuth credentials JSON
|
|
40
|
-
4. Run: `gmcli accounts credentials ~/path/to/credentials.json`
|
|
41
|
-
5. Run: `gmcli accounts add <email>` (use `--manual` for browserless OAuth)
|
|
42
|
-
|
|
43
|
-
## Usage
|
|
44
|
-
|
|
45
|
-
Run `gmcli --help` for full command reference.
|
|
46
|
-
|
|
47
|
-
Common operations:
|
|
48
|
-
- `gmcli <email> search "<query>"` - Search emails using Gmail query syntax
|
|
49
|
-
- `gmcli <email> thread <threadId>` - Read a thread with all messages
|
|
50
|
-
- `gmcli <email> send --to <emails> --subject <s> --body <b>` - Send email
|
|
51
|
-
- `gmcli <email> labels list` - List all labels
|
|
52
|
-
- `gmcli <email> drafts list` - List drafts
|
|
53
|
-
|
|
54
|
-
## Data Storage
|
|
55
|
-
|
|
56
|
-
- `~/.gmcli/credentials.json` - OAuth client credentials
|
|
57
|
-
- `~/.gmcli/accounts.json` - Account tokens
|
|
58
|
-
- `~/.gmcli/attachments/` - Downloaded attachments
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: transcribe
|
|
3
|
-
description: Speech-to-text transcription using Groq Whisper API. Supports m4a, mp3, wav, ogg, flac, webm.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Transcribe
|
|
7
|
-
|
|
8
|
-
Speech-to-text using Groq Whisper API.
|
|
9
|
-
|
|
10
|
-
## Setup
|
|
11
|
-
|
|
12
|
-
The script needs `GROQ_API_KEY` environment variable. Check if already set:
|
|
13
|
-
```bash
|
|
14
|
-
echo $GROQ_API_KEY
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
If not set, guide the user through setup:
|
|
18
|
-
1. Ask if they have a Groq API key
|
|
19
|
-
2. If not, have them sign up at https://console.groq.com/ and create an API key
|
|
20
|
-
3. Have them add to their shell profile (~/.zshrc or ~/.bashrc):
|
|
21
|
-
```bash
|
|
22
|
-
export GROQ_API_KEY="<their-api-key>"
|
|
23
|
-
```
|
|
24
|
-
4. Then run `source ~/.zshrc` (or restart terminal)
|
|
25
|
-
|
|
26
|
-
## Usage
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
{baseDir}/transcribe.sh <audio-file>
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Supported Formats
|
|
33
|
-
|
|
34
|
-
- m4a, mp3, wav, ogg, flac, webm
|
|
35
|
-
- Max file size: 25MB
|
|
36
|
-
|
|
37
|
-
## Output
|
|
38
|
-
|
|
39
|
-
Returns plain text transcription with punctuation and proper capitalization to stdout.
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
4
|
-
|
|
5
|
-
# Source config if available
|
|
6
|
-
if [ -f "$SCRIPT_DIR/config" ]; then
|
|
7
|
-
source "$SCRIPT_DIR/config"
|
|
8
|
-
fi
|
|
9
|
-
|
|
10
|
-
if [ -z "$1" ]; then
|
|
11
|
-
echo "Usage: transcribe.sh <audio-file>"
|
|
12
|
-
exit 1
|
|
13
|
-
fi
|
|
14
|
-
|
|
15
|
-
if [ -z "$GROQ_API_KEY" ]; then
|
|
16
|
-
echo "Error: GROQ_API_KEY not set. Create config file with: echo 'GROQ_API_KEY=\"your-key\"' > $SCRIPT_DIR/config"
|
|
17
|
-
exit 1
|
|
18
|
-
fi
|
|
19
|
-
|
|
20
|
-
AUDIO_FILE="$1"
|
|
21
|
-
|
|
22
|
-
if [ ! -f "$AUDIO_FILE" ]; then
|
|
23
|
-
echo "Error: File not found: $AUDIO_FILE"
|
|
24
|
-
exit 1
|
|
25
|
-
fi
|
|
26
|
-
|
|
27
|
-
curl -s -X POST "https://api.groq.com/openai/v1/audio/transcriptions" \
|
|
28
|
-
-H "Authorization: Bearer $GROQ_API_KEY" \
|
|
29
|
-
-F "file=@${AUDIO_FILE}" \
|
|
30
|
-
-F "model=whisper-large-v3-turbo" \
|
|
31
|
-
-F "response_format=text"
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: vscode
|
|
3
|
-
description: VS Code integration for viewing diffs and comparing files. Use when showing file differences to the user.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# VS Code CLI Tools
|
|
7
|
-
|
|
8
|
-
Tools for integrating with VS Code, primarily for viewing diffs.
|
|
9
|
-
|
|
10
|
-
## Requirements
|
|
11
|
-
|
|
12
|
-
VS Code must be installed with the `code` CLI available in PATH.
|
|
13
|
-
|
|
14
|
-
## Opening a Diff
|
|
15
|
-
|
|
16
|
-
Compare two files side by side in VS Code:
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
code -d <file1> <file2>
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Git Diffs in VS Code
|
|
23
|
-
|
|
24
|
-
### Simple Approach (no config needed)
|
|
25
|
-
|
|
26
|
-
Extract the old version to a temp file, then diff:
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
# Compare with previous commit
|
|
30
|
-
git show HEAD~1:path/to/file > /tmp/old && code -d /tmp/old path/to/file
|
|
31
|
-
|
|
32
|
-
# Compare with specific commit
|
|
33
|
-
git show abc123:path/to/file > /tmp/old && code -d /tmp/old path/to/file
|
|
34
|
-
|
|
35
|
-
# Compare staged version with working tree
|
|
36
|
-
git show :path/to/file > /tmp/staged && code -d /tmp/staged path/to/file
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Gotchas
|
|
40
|
-
|
|
41
|
-
- File must exist and have changes between the compared revisions
|
|
42
|
-
- Use `git log --oneline -5 -- path/to/file` to verify file has history before diffing
|
|
43
|
-
|
|
44
|
-
## When to Use
|
|
45
|
-
|
|
46
|
-
- Showing the user what changed in a file
|
|
47
|
-
- Comparing two versions of code
|
|
48
|
-
- Reviewing git changes visually
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: youtube-transcript
|
|
3
|
-
description: Fetch transcripts from YouTube videos for summarization and analysis.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# YouTube Transcript
|
|
7
|
-
|
|
8
|
-
Fetch transcripts from YouTube videos.
|
|
9
|
-
|
|
10
|
-
## Setup
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
cd {baseDir}
|
|
14
|
-
npm install
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
{baseDir}/transcript.js <video-id-or-url>
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Accepts video ID or full URL:
|
|
24
|
-
- `EBw7gsDPAYQ`
|
|
25
|
-
- `https://www.youtube.com/watch?v=EBw7gsDPAYQ`
|
|
26
|
-
- `https://youtu.be/EBw7gsDPAYQ`
|
|
27
|
-
|
|
28
|
-
## Output
|
|
29
|
-
|
|
30
|
-
Timestamped transcript entries:
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
[0:00] All right. So, I got this UniFi Theta
|
|
34
|
-
[0:15] I took the camera out, painted it
|
|
35
|
-
[1:23] And here's the final result
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Notes
|
|
39
|
-
|
|
40
|
-
- Requires the video to have captions/transcripts available
|
|
41
|
-
- Works with auto-generated and manual transcripts
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { YoutubeTranscript } from 'youtube-transcript-plus';
|
|
4
|
-
|
|
5
|
-
const videoId = process.argv[2];
|
|
6
|
-
|
|
7
|
-
if (!videoId) {
|
|
8
|
-
console.error('Usage: transcript.js <video-id-or-url>');
|
|
9
|
-
console.error('Example: transcript.js EBw7gsDPAYQ');
|
|
10
|
-
console.error('Example: transcript.js https://www.youtube.com/watch?v=EBw7gsDPAYQ');
|
|
11
|
-
process.exit(1);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Extract video ID if full URL is provided
|
|
15
|
-
let extractedId = videoId;
|
|
16
|
-
if (videoId.includes('youtube.com') || videoId.includes('youtu.be')) {
|
|
17
|
-
const match = videoId.match(/(?:v=|youtu\.be\/)([a-zA-Z0-9_-]{11})/);
|
|
18
|
-
if (match) {
|
|
19
|
-
extractedId = match[1];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
const transcript = await YoutubeTranscript.fetchTranscript(extractedId);
|
|
25
|
-
|
|
26
|
-
for (const entry of transcript) {
|
|
27
|
-
const timestamp = formatTimestamp(entry.offset / 1000);
|
|
28
|
-
console.log(`[${timestamp}] ${entry.text}`);
|
|
29
|
-
}
|
|
30
|
-
} catch (error) {
|
|
31
|
-
console.error('Error fetching transcript:', error.message);
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function formatTimestamp(seconds) {
|
|
36
|
-
const h = Math.floor(seconds / 3600);
|
|
37
|
-
const m = Math.floor((seconds % 3600) / 60);
|
|
38
|
-
const s = Math.floor(seconds % 60);
|
|
39
|
-
|
|
40
|
-
if (h > 0) {
|
|
41
|
-
return `${h}:${m.toString().padStart(2, '0')}:${s.toString().padStart(2, '0')}`;
|
|
42
|
-
}
|
|
43
|
-
return `${m}:${s.toString().padStart(2, '0')}`;
|
|
44
|
-
}
|