@framers/agentos-ext-channel-youtube 0.1.4 → 0.1.5
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 +157 -0
- package/manifest.json +1 -1
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# YouTube channel
|
|
2
|
+
|
|
3
|
+
This pack gives an agent video and Shorts uploads, comments, search, trends, statistics, playlist management and scheduled publishing through the YouTube Data API using `googleapis`.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @framers/agentos-ext-channel-youtube
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Peer dependency: `@framers/agentos` `>=0.10.40`.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { AgentOS } from '@framers/agentos';
|
|
17
|
+
|
|
18
|
+
const agentos = await AgentOS.create({
|
|
19
|
+
extensionManifest: {
|
|
20
|
+
packs: [
|
|
21
|
+
{
|
|
22
|
+
package: '@framers/agentos-ext-channel-youtube',
|
|
23
|
+
options: { apiKey: process.env.YOUTUBE_API_KEY },
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Configuration
|
|
31
|
+
|
|
32
|
+
| Option | Secret id | Environment variable | Required | Default |
|
|
33
|
+
| --- | --- | --- | --- | --- |
|
|
34
|
+
| `apiKey` | `youtube.apiKey` | Variable named by `apiKeyEnv`, then `YOUTUBE_API_KEY`, then `GOOGLE_API_KEY` | Yes | None |
|
|
35
|
+
| `apiKeyEnv` | None | None | No | `YOUTUBE_API_KEY` |
|
|
36
|
+
| `oauth` | None | None | No | Resolved credentials if complete, otherwise none |
|
|
37
|
+
| `oauth.clientId` | `youtube.oauth.clientId` | `YOUTUBE_OAUTH_CLIENT_ID` | No | None |
|
|
38
|
+
| `oauth.clientSecret` | `youtube.oauth.clientSecret` | `YOUTUBE_OAUTH_CLIENT_SECRET` | No | None |
|
|
39
|
+
| `oauth.refreshToken` | `youtube.oauth.refreshToken` | `YOUTUBE_OAUTH_REFRESH_TOKEN` | No | None |
|
|
40
|
+
| `priority` | None | None | No | `50` |
|
|
41
|
+
| `secrets` | `youtube.apiKey`, `youtube.oauth.clientId`, `youtube.oauth.clientSecret`, `youtube.oauth.refreshToken` | None | No | None |
|
|
42
|
+
|
|
43
|
+
The API key resolves from options, then `options.secrets`, then environment variables. The first environment lookup uses `apiKeyEnv`, which defaults to `YOUTUBE_API_KEY`. An explicit `oauth` object overrides OAuth secret and environment resolution. Otherwise each OAuth field resolves from secrets before its environment variable, and OAuth is enabled only when all fields resolve. The `oauth` interface requires all fields when the object is supplied.
|
|
44
|
+
|
|
45
|
+
## Tools
|
|
46
|
+
|
|
47
|
+
| Tool | What it does |
|
|
48
|
+
| --- | --- |
|
|
49
|
+
| `youtubeUpload` | Upload a video with title, description, tags and privacy settings. |
|
|
50
|
+
| `youtubeShort` | Upload a Short with a `#Shorts` tag. |
|
|
51
|
+
| `youtubeComment` | Post a comment or reply to an existing comment. |
|
|
52
|
+
| `youtubeSearch` | Search videos, channels or playlists by keyword. |
|
|
53
|
+
| `youtubeTrending` | Get popular videos by region and category. |
|
|
54
|
+
| `youtubeAnalytics` | Get video or channel performance metrics. |
|
|
55
|
+
| `youtubePlaylist` | Create, list, add videos to or delete playlists. |
|
|
56
|
+
| `youtubeSchedule` | Upload a private video for scheduled public publishing. |
|
|
57
|
+
|
|
58
|
+
### `youtubeUpload`
|
|
59
|
+
|
|
60
|
+
| Parameter | Type | Required | Description |
|
|
61
|
+
| --- | --- | --- | --- |
|
|
62
|
+
| `videoUrl` | string | Yes | URL of the video file to upload |
|
|
63
|
+
| `title` | string | Yes | Video title (max `100` chars) |
|
|
64
|
+
| `description` | string | Yes | Video description (max `5000` chars) |
|
|
65
|
+
| `tags` | string[] | No | Video tags for discoverability |
|
|
66
|
+
| `categoryId` | string | No | YouTube category ID (default: `22`, People & Blogs) |
|
|
67
|
+
| `privacyStatus` | string: `public`, `private`, `unlisted` | No | Privacy status (default: `public`) |
|
|
68
|
+
| `mimeType` | string | No | Video MIME type (default: `video/mp4`) |
|
|
69
|
+
|
|
70
|
+
### `youtubeShort`
|
|
71
|
+
|
|
72
|
+
| Parameter | Type | Required | Description |
|
|
73
|
+
| --- | --- | --- | --- |
|
|
74
|
+
| `videoUrl` | string | Yes | URL of the short-form video file |
|
|
75
|
+
| `title` | string | Yes | Short title (max `100` chars) |
|
|
76
|
+
| `description` | string | No | Short description |
|
|
77
|
+
| `tags` | string[] | No | Additional tags (besides `#Shorts`) |
|
|
78
|
+
| `privacyStatus` | string: `public`, `private`, `unlisted` | No | Privacy status (default: `public`) |
|
|
79
|
+
|
|
80
|
+
### `youtubeComment`
|
|
81
|
+
|
|
82
|
+
| Parameter | Type | Required | Description |
|
|
83
|
+
| --- | --- | --- | --- |
|
|
84
|
+
| `videoId` | string | Yes | YouTube video ID |
|
|
85
|
+
| `text` | string | Yes | Comment text |
|
|
86
|
+
| `parentCommentId` | string | No | Parent comment ID for replying to a comment |
|
|
87
|
+
|
|
88
|
+
### `youtubeSearch`
|
|
89
|
+
|
|
90
|
+
| Parameter | Type | Required | Description |
|
|
91
|
+
| --- | --- | --- | --- |
|
|
92
|
+
| `query` | string | Yes | Search query |
|
|
93
|
+
| `type` | string: `video`, `channel`, `playlist` | No | Search type (default: `video`) |
|
|
94
|
+
| `maxResults` | number | No | Max results to return (default: `10`, max: `50`) |
|
|
95
|
+
| `order` | string: `relevance`, `date`, `rating`, `viewCount`, `title` | No | Sort order (default: `relevance`) |
|
|
96
|
+
| `regionCode` | string | No | ISO 3166-1 alpha-2 region code (e.g., `US`, `GB`) |
|
|
97
|
+
|
|
98
|
+
### `youtubeTrending`
|
|
99
|
+
|
|
100
|
+
| Parameter | Type | Required | Description |
|
|
101
|
+
| --- | --- | --- | --- |
|
|
102
|
+
| `regionCode` | string | No | ISO 3166-1 alpha-2 region code (default: `US`) |
|
|
103
|
+
| `categoryId` | string | No | YouTube video category ID (e.g., `10` for Music, `17` for Sports, `20` for Gaming) |
|
|
104
|
+
| `maxResults` | number | No | Max results to return (default: `20`, max: `50`) |
|
|
105
|
+
|
|
106
|
+
### `youtubeAnalytics`
|
|
107
|
+
|
|
108
|
+
| Parameter | Type | Required | Description |
|
|
109
|
+
| --- | --- | --- | --- |
|
|
110
|
+
| `type` | string: `video`, `channel` | Yes | Whether to get analytics for a video or a channel |
|
|
111
|
+
| `videoId` | string | No | Video ID (required when `type` is `video`) |
|
|
112
|
+
| `channelId` | string | No | Channel ID (optional for `type` `channel`, defaults to own channel if OAuth is set up) |
|
|
113
|
+
|
|
114
|
+
### `youtubePlaylist`
|
|
115
|
+
|
|
116
|
+
| Parameter | Type | Required | Description |
|
|
117
|
+
| --- | --- | --- | --- |
|
|
118
|
+
| `action` | string: `create`, `list`, `listItems`, `addVideo`, `delete` | Yes | Playlist action to perform |
|
|
119
|
+
| `title` | string | No | Playlist title (required for create) |
|
|
120
|
+
| `description` | string | No | Playlist description |
|
|
121
|
+
| `privacyStatus` | string: `public`, `private`, `unlisted` | No | Privacy status (default: `public`) |
|
|
122
|
+
| `playlistId` | string | No | Playlist ID (required for `listItems`, `addVideo`, `delete`) |
|
|
123
|
+
| `videoId` | string | No | Video ID (required for `addVideo`) |
|
|
124
|
+
| `channelId` | string | No | Channel ID (optional for list, defaults to own channel) |
|
|
125
|
+
| `maxResults` | number | No | Max results for list operations |
|
|
126
|
+
|
|
127
|
+
### `youtubeSchedule`
|
|
128
|
+
|
|
129
|
+
| Parameter | Type | Required | Description |
|
|
130
|
+
| --- | --- | --- | --- |
|
|
131
|
+
| `videoUrl` | string | Yes | URL of the video file to upload |
|
|
132
|
+
| `title` | string | Yes | Video title (max `100` chars) |
|
|
133
|
+
| `description` | string | Yes | Video description (max `5000` chars) |
|
|
134
|
+
| `publishAt` | string | Yes | ISO 8601 datetime for scheduled publish time |
|
|
135
|
+
| `tags` | string[] | No | Video tags for discoverability |
|
|
136
|
+
| `categoryId` | string | No | YouTube category ID (default: `22`, People & Blogs) |
|
|
137
|
+
| `mimeType` | string | No | Video MIME type (default: `video/mp4`) |
|
|
138
|
+
|
|
139
|
+
## Channel adapter
|
|
140
|
+
|
|
141
|
+
The adapter registers platform `youtube`. Activation initializes the API service, and connection status follows its running state. A video block triggers an upload from its HTTPS URL; metadata comes from `platformOptions.title`, `platformOptions.tags`, `platformOptions.categoryId` and `platformOptions.privacyStatus`. The title falls back to the video caption, then `Untitled`; a text block supplies the description before the caption fallback.
|
|
142
|
+
|
|
143
|
+
Without a video block, sending posts a comment using `conversationId` as the video ID and `replyToMessageId` as the optional parent comment ID. Empty video IDs or comment text throw. The adapter stores event handlers but emits no inbound events. Typing indicators do nothing.
|
|
144
|
+
|
|
145
|
+
## Notes
|
|
146
|
+
|
|
147
|
+
Creating the pack throws if no API key resolves. Uploads, comments, playlist creation, playlist additions and playlist deletion require OAuth credentials and change content on the account. Listing the account's own playlists also requires OAuth. Channel analytics require `channelId` when OAuth is absent.
|
|
148
|
+
|
|
149
|
+
Upload tools fetch HTTP or HTTPS video URLs and stream responses to the API. They set no download timeout, check no HTTP response status and implement no redirect handling. The service defaults uploads to `public`, `video/mp4` and the People & Blogs category, and sets `selfDeclaredMadeForKids` to `false`.
|
|
150
|
+
|
|
151
|
+
Shorts uploads add `Shorts` to tags and append `#Shorts` to the description. The code does not validate duration or orientation. Scheduling rejects invalid or past dates, then uploads with `private` privacy and `publishAt`; it uses no local publishing timer.
|
|
152
|
+
|
|
153
|
+
Search, trending and playlist listing requests are capped at `50` results. Playlist lists default to `25` results. Tool failures return `success: false` and an error message. Action-specific playlist fields and video analytics IDs are checked during execution despite being optional in their schemas.
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
Apache-2.0
|
package/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://agentos.sh/schemas/extension-manifest-v1.json",
|
|
3
3
|
"id": "com.framers.channels.youtube",
|
|
4
4
|
"name": "YouTube Channel Extension",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.5",
|
|
6
6
|
"description": "YouTube integration — upload videos, publish Shorts, comment on videos, search content, discover trending, track analytics, manage playlists, and schedule publishing via YouTube Data API v3.",
|
|
7
7
|
"categories": ["channel", "social"],
|
|
8
8
|
"platforms": ["youtube"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@framers/agentos-ext-channel-youtube",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "YouTube channel adapter for AgentOS — upload videos, publish Shorts, comment, search, track analytics, manage playlists, and schedule via YouTube Data API v3.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@types/node": "^20.0.0",
|
|
20
20
|
"typescript": "^5.0.0",
|
|
21
21
|
"vitest": "^3.2.7",
|
|
22
|
-
"@framers/agentos": "^0.13.
|
|
22
|
+
"@framers/agentos": "^0.13.47"
|
|
23
23
|
},
|
|
24
24
|
"engines": {
|
|
25
25
|
"node": ">=22"
|