Skip to content

Commit 8255483

Browse files
committed
feat(youtube): add captions, trending, and video categories tools with enhanced API coverage
1 parent 06d7ce7 commit 8255483

File tree

16 files changed

+1164
-212
lines changed

16 files changed

+1164
-212
lines changed

apps/docs/content/docs/en/tools/youtube.mdx

Lines changed: 196 additions & 85 deletions
Large diffs are not rendered by default.

apps/sim/blocks/blocks/tinybird.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,13 @@ export const TinybirdBlock: BlockConfig<TinybirdResponse> = {
7777
{ label: 'None', id: 'none' },
7878
{ label: 'Gzip', id: 'gzip' },
7979
],
80-
value: () => 'none',
8180
mode: 'advanced',
8281
condition: { field: 'operation', value: 'tinybird_events' },
8382
},
8483
{
8584
id: 'wait',
8685
title: 'Wait for Acknowledgment',
8786
type: 'switch',
88-
value: () => 'false',
8987
mode: 'advanced',
9088
condition: { field: 'operation', value: 'tinybird_events' },
9189
},

apps/sim/blocks/blocks/youtube.ts

Lines changed: 139 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const YouTubeBlock: BlockConfig<YouTubeResponse> = {
99
description: 'Interact with YouTube videos, channels, and playlists',
1010
authMode: AuthMode.ApiKey,
1111
longDescription:
12-
'Integrate YouTube into the workflow. Can search for videos, get video details, get channel information, get all videos from a channel, get channel playlists, get playlist items, find related videos, and get video comments.',
12+
'Integrate YouTube into the workflow. Can search for videos, get trending videos, get video details, get video captions, get video categories, get channel information, get all videos from a channel, get channel playlists, get playlist items, and get video comments.',
1313
docsLink: 'https://docs.sim.ai/tools/youtube',
1414
category: 'tools',
1515
bgColor: '#FF0000',
@@ -21,7 +21,10 @@ export const YouTubeBlock: BlockConfig<YouTubeResponse> = {
2121
type: 'dropdown',
2222
options: [
2323
{ label: 'Search Videos', id: 'youtube_search' },
24+
{ label: 'Get Trending Videos', id: 'youtube_trending' },
2425
{ label: 'Get Video Details', id: 'youtube_video_details' },
26+
{ label: 'Get Video Captions', id: 'youtube_captions' },
27+
{ label: 'Get Video Categories', id: 'youtube_video_categories' },
2528
{ label: 'Get Channel Info', id: 'youtube_channel_info' },
2629
{ label: 'Get Channel Videos', id: 'youtube_channel_videos' },
2730
{ label: 'Get Channel Playlists', id: 'youtube_channel_playlists' },
@@ -49,13 +52,33 @@ export const YouTubeBlock: BlockConfig<YouTubeResponse> = {
4952
integer: true,
5053
condition: { field: 'operation', value: 'youtube_search' },
5154
},
55+
{
56+
id: 'pageToken',
57+
title: 'Page Token',
58+
type: 'short-input',
59+
placeholder: 'Token for pagination (from nextPageToken)',
60+
condition: { field: 'operation', value: 'youtube_search' },
61+
},
5262
{
5363
id: 'channelId',
5464
title: 'Filter by Channel ID',
5565
type: 'short-input',
5666
placeholder: 'Filter results to a specific channel',
5767
condition: { field: 'operation', value: 'youtube_search' },
5868
},
69+
{
70+
id: 'eventType',
71+
title: 'Live Stream Filter',
72+
type: 'dropdown',
73+
options: [
74+
{ label: 'All Videos', id: '' },
75+
{ label: 'Currently Live', id: 'live' },
76+
{ label: 'Upcoming Streams', id: 'upcoming' },
77+
{ label: 'Past Streams', id: 'completed' },
78+
],
79+
value: () => '',
80+
condition: { field: 'operation', value: 'youtube_search' },
81+
},
5982
{
6083
id: 'publishedAfter',
6184
title: 'Published After',
@@ -131,7 +154,7 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
131154
id: 'videoCategoryId',
132155
title: 'Category ID',
133156
type: 'short-input',
134-
placeholder: '10 for Music, 20 for Gaming',
157+
placeholder: 'Use Get Video Categories to find IDs',
135158
condition: { field: 'operation', value: 'youtube_search' },
136159
},
137160
{
@@ -163,7 +186,10 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
163186
title: 'Region Code',
164187
type: 'short-input',
165188
placeholder: 'US, GB, JP',
166-
condition: { field: 'operation', value: 'youtube_search' },
189+
condition: {
190+
field: 'operation',
191+
value: ['youtube_search', 'youtube_trending', 'youtube_video_categories'],
192+
},
167193
},
168194
{
169195
id: 'relevanceLanguage',
@@ -184,6 +210,31 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
184210
value: () => 'moderate',
185211
condition: { field: 'operation', value: 'youtube_search' },
186212
},
213+
// Get Trending Videos operation inputs
214+
{
215+
id: 'maxResults',
216+
title: 'Max Results',
217+
type: 'slider',
218+
min: 1,
219+
max: 50,
220+
step: 1,
221+
integer: true,
222+
condition: { field: 'operation', value: 'youtube_trending' },
223+
},
224+
{
225+
id: 'videoCategoryId',
226+
title: 'Category ID',
227+
type: 'short-input',
228+
placeholder: 'Use Get Video Categories to find IDs',
229+
condition: { field: 'operation', value: 'youtube_trending' },
230+
},
231+
{
232+
id: 'pageToken',
233+
title: 'Page Token',
234+
type: 'short-input',
235+
placeholder: 'Token for pagination (from nextPageToken)',
236+
condition: { field: 'operation', value: 'youtube_trending' },
237+
},
187238
// Get Video Details operation inputs
188239
{
189240
id: 'videoId',
@@ -193,6 +244,23 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
193244
required: true,
194245
condition: { field: 'operation', value: 'youtube_video_details' },
195246
},
247+
// Get Video Captions operation inputs
248+
{
249+
id: 'videoId',
250+
title: 'Video ID',
251+
type: 'short-input',
252+
placeholder: 'Enter YouTube video ID',
253+
required: true,
254+
condition: { field: 'operation', value: 'youtube_captions' },
255+
},
256+
// Get Video Categories operation inputs
257+
{
258+
id: 'hl',
259+
title: 'Language',
260+
type: 'short-input',
261+
placeholder: 'en, es, fr (for category names)',
262+
condition: { field: 'operation', value: 'youtube_video_categories' },
263+
},
196264
// Get Channel Info operation inputs
197265
{
198266
id: 'channelId',
@@ -241,6 +309,13 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
241309
value: () => 'date',
242310
condition: { field: 'operation', value: 'youtube_channel_videos' },
243311
},
312+
{
313+
id: 'pageToken',
314+
title: 'Page Token',
315+
type: 'short-input',
316+
placeholder: 'Token for pagination (from nextPageToken)',
317+
condition: { field: 'operation', value: 'youtube_channel_videos' },
318+
},
244319
// Get Channel Playlists operation inputs
245320
{
246321
id: 'channelId',
@@ -260,6 +335,13 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
260335
integer: true,
261336
condition: { field: 'operation', value: 'youtube_channel_playlists' },
262337
},
338+
{
339+
id: 'pageToken',
340+
title: 'Page Token',
341+
type: 'short-input',
342+
placeholder: 'Token for pagination (from nextPageToken)',
343+
condition: { field: 'operation', value: 'youtube_channel_playlists' },
344+
},
263345
// Get Playlist Items operation inputs
264346
{
265347
id: 'playlistId',
@@ -279,6 +361,13 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
279361
integer: true,
280362
condition: { field: 'operation', value: 'youtube_playlist_items' },
281363
},
364+
{
365+
id: 'pageToken',
366+
title: 'Page Token',
367+
type: 'short-input',
368+
placeholder: 'Token for pagination (from nextPageToken)',
369+
condition: { field: 'operation', value: 'youtube_playlist_items' },
370+
},
282371
// Get Video Comments operation inputs
283372
{
284373
id: 'videoId',
@@ -309,6 +398,13 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
309398
value: () => 'relevance',
310399
condition: { field: 'operation', value: 'youtube_comments' },
311400
},
401+
{
402+
id: 'pageToken',
403+
title: 'Page Token',
404+
type: 'short-input',
405+
placeholder: 'Token for pagination (from nextPageToken)',
406+
condition: { field: 'operation', value: 'youtube_comments' },
407+
},
312408
// API Key (common to all operations)
313409
{
314410
id: 'apiKey',
@@ -321,13 +417,16 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
321417
],
322418
tools: {
323419
access: [
324-
'youtube_search',
325-
'youtube_video_details',
420+
'youtube_captions',
326421
'youtube_channel_info',
327-
'youtube_channel_videos',
328422
'youtube_channel_playlists',
329-
'youtube_playlist_items',
423+
'youtube_channel_videos',
330424
'youtube_comments',
425+
'youtube_playlist_items',
426+
'youtube_search',
427+
'youtube_trending',
428+
'youtube_video_categories',
429+
'youtube_video_details',
331430
],
332431
config: {
333432
tool: (params) => {
@@ -339,8 +438,14 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
339438
switch (params.operation) {
340439
case 'youtube_search':
341440
return 'youtube_search'
441+
case 'youtube_trending':
442+
return 'youtube_trending'
342443
case 'youtube_video_details':
343444
return 'youtube_video_details'
445+
case 'youtube_captions':
446+
return 'youtube_captions'
447+
case 'youtube_video_categories':
448+
return 'youtube_video_categories'
344449
case 'youtube_channel_info':
345450
return 'youtube_channel_info'
346451
case 'youtube_channel_videos':
@@ -363,17 +468,20 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
363468
// Search Videos
364469
query: { type: 'string', description: 'Search query' },
365470
maxResults: { type: 'number', description: 'Maximum number of results' },
471+
pageToken: { type: 'string', description: 'Page token for pagination' },
366472
// Search Filters
367473
publishedAfter: { type: 'string', description: 'Published after date (RFC 3339)' },
368474
publishedBefore: { type: 'string', description: 'Published before date (RFC 3339)' },
369475
videoDuration: { type: 'string', description: 'Video duration filter' },
370476
videoCategoryId: { type: 'string', description: 'YouTube category ID' },
371477
videoDefinition: { type: 'string', description: 'Video quality filter' },
372478
videoCaption: { type: 'string', description: 'Caption availability filter' },
479+
eventType: { type: 'string', description: 'Live stream filter (live/upcoming/completed)' },
373480
regionCode: { type: 'string', description: 'Region code (ISO 3166-1)' },
374481
relevanceLanguage: { type: 'string', description: 'Language code (ISO 639-1)' },
375482
safeSearch: { type: 'string', description: 'Safe search level' },
376-
// Video Details & Comments
483+
hl: { type: 'string', description: 'Language for category names' },
484+
// Video Details, Comments & Captions
377485
videoId: { type: 'string', description: 'YouTube video ID' },
378486
// Channel Info
379487
channelId: { type: 'string', description: 'YouTube channel ID' },
@@ -384,7 +492,7 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
384492
order: { type: 'string', description: 'Sort order' },
385493
},
386494
outputs: {
387-
// Search Videos & Playlist Items
495+
// Search Videos, Trending, Playlist Items, Captions, Categories
388496
items: { type: 'json', description: 'List of items returned' },
389497
totalResults: { type: 'number', description: 'Total number of results' },
390498
nextPageToken: { type: 'string', description: 'Token for next page' },
@@ -399,11 +507,33 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
399507
viewCount: { type: 'number', description: 'View count' },
400508
likeCount: { type: 'number', description: 'Like count' },
401509
commentCount: { type: 'number', description: 'Comment count' },
510+
favoriteCount: { type: 'number', description: 'Favorite count' },
402511
thumbnail: { type: 'string', description: 'Thumbnail URL' },
403512
tags: { type: 'json', description: 'Video tags' },
513+
categoryId: { type: 'string', description: 'Video category ID' },
514+
definition: { type: 'string', description: 'Video definition (hd/sd)' },
515+
caption: { type: 'string', description: 'Has captions (true/false)' },
516+
licensedContent: { type: 'boolean', description: 'Is licensed content' },
517+
privacyStatus: { type: 'string', description: 'Privacy status' },
518+
liveBroadcastContent: { type: 'string', description: 'Live broadcast status' },
519+
defaultLanguage: { type: 'string', description: 'Default language' },
520+
defaultAudioLanguage: { type: 'string', description: 'Default audio language' },
521+
// Live Streaming Details
522+
isLiveContent: { type: 'boolean', description: 'Whether video is/was a live stream' },
523+
scheduledStartTime: { type: 'string', description: 'Scheduled start time for live streams' },
524+
actualStartTime: { type: 'string', description: 'Actual start time of live stream' },
525+
actualEndTime: { type: 'string', description: 'End time of live stream' },
526+
concurrentViewers: { type: 'number', description: 'Current viewers (live only)' },
527+
activeLiveChatId: { type: 'string', description: 'Live chat ID' },
404528
// Channel Info
405529
subscriberCount: { type: 'number', description: 'Subscriber count' },
406530
videoCount: { type: 'number', description: 'Total video count' },
407531
customUrl: { type: 'string', description: 'Channel custom URL' },
532+
country: { type: 'string', description: 'Channel country' },
533+
uploadsPlaylistId: { type: 'string', description: 'Uploads playlist ID' },
534+
bannerImageUrl: { type: 'string', description: 'Channel banner URL' },
535+
hiddenSubscriberCount: { type: 'boolean', description: 'Is subscriber count hidden' },
536+
// Video Categories
537+
assignable: { type: 'boolean', description: 'Whether category can be assigned' },
408538
},
409539
}

apps/sim/tools/registry.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,12 +1642,15 @@ import {
16421642
import { workflowExecutorTool } from '@/tools/workflow'
16431643
import { xReadTool, xSearchTool, xUserTool, xWriteTool } from '@/tools/x'
16441644
import {
1645+
youtubeCaptionsTool,
16451646
youtubeChannelInfoTool,
16461647
youtubeChannelPlaylistsTool,
16471648
youtubeChannelVideosTool,
16481649
youtubeCommentsTool,
16491650
youtubePlaylistItemsTool,
16501651
youtubeSearchTool,
1652+
youtubeTrendingTool,
1653+
youtubeVideoCategoriesTool,
16511654
youtubeVideoDetailsTool,
16521655
} from '@/tools/youtube'
16531656
import {
@@ -1982,13 +1985,16 @@ export const tools: Record<string, ToolConfig> = {
19821985
typeform_create_form: typeformCreateFormTool,
19831986
typeform_update_form: typeformUpdateFormTool,
19841987
typeform_delete_form: typeformDeleteFormTool,
1985-
youtube_search: youtubeSearchTool,
1986-
youtube_video_details: youtubeVideoDetailsTool,
1988+
youtube_captions: youtubeCaptionsTool,
19871989
youtube_channel_info: youtubeChannelInfoTool,
1988-
youtube_playlist_items: youtubePlaylistItemsTool,
1989-
youtube_comments: youtubeCommentsTool,
1990-
youtube_channel_videos: youtubeChannelVideosTool,
19911990
youtube_channel_playlists: youtubeChannelPlaylistsTool,
1991+
youtube_channel_videos: youtubeChannelVideosTool,
1992+
youtube_comments: youtubeCommentsTool,
1993+
youtube_playlist_items: youtubePlaylistItemsTool,
1994+
youtube_search: youtubeSearchTool,
1995+
youtube_trending: youtubeTrendingTool,
1996+
youtube_video_categories: youtubeVideoCategoriesTool,
1997+
youtube_video_details: youtubeVideoDetailsTool,
19921998
notion_read: notionReadTool,
19931999
notion_read_database: notionReadDatabaseTool,
19942000
notion_write: notionWriteTool,

0 commit comments

Comments
 (0)