-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat(tools): added additional youtube search params, get channel playlists videos and related videos tools #1814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…lists videos and related videos tools
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
This PR enhances the YouTube integration with advanced filtering capabilities and three new tools, directly addressing issue #1793.
Key Changes:
- Enhanced
youtube_searchwith 11 new filtering parameters: channel ID, date range (publishedAfter/Before), video duration, sort order, category ID, video quality, captions, region code, language, and safe search - Added
youtube_channel_videostool to retrieve all videos from a specific channel with sorting options - Added
youtube_channel_playliststool to get all playlists from a channel - Added
youtube_related_videostool to find videos related to a specific video - Updated all type definitions and block configurations to support new functionality
- Comprehensive documentation updates with clear parameter descriptions and examples
Implementation Quality:
- All new tools follow established patterns in the codebase (URL construction, response transformation, error handling)
- Proper TypeScript typing throughout with comprehensive interfaces
- Consistent use of optional chaining and fallback values for robust data handling
- Block configuration uses conditional fields appropriately to show relevant inputs per operation
- All API parameters properly URL-encoded
- Pagination support included via
pageTokenandnextPageToken
Testing Considerations:
- Verify YouTube API quota limits with the additional parameters
- Test edge cases: empty results, invalid channel IDs, malformed date strings
- Confirm RFC 3339 date format validation for
publishedAfter/publishedBeforeparameters
Confidence Score: 5/5
- This PR is safe to merge with no critical issues found
- The implementation is solid and follows all established patterns in the codebase. All new tools properly handle edge cases with fallback values, use consistent error handling patterns, and include proper TypeScript typing. The changes are additive (no breaking changes), well-documented, and address the feature request comprehensively.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/tools/youtube/search.ts | 5/5 | Enhanced with 11 new filtering parameters (channel, date range, duration, category, quality, captions, region, language, safe search). All parameters properly encoded and passed to YouTube API. |
| apps/sim/tools/youtube/channel_videos.ts | 5/5 | New tool to get all videos from a channel using search API with type=video filter. Properly handles pagination and sorting options. |
| apps/sim/tools/youtube/channel_playlists.ts | 5/5 | New tool to retrieve channel playlists with proper error handling for empty results. Includes itemCount from contentDetails. |
| apps/sim/tools/youtube/related_videos.ts | 5/5 | New tool using relatedToVideoId parameter. Implementation follows established patterns with proper thumbnail fallback logic. |
| apps/sim/blocks/blocks/youtube.ts | 5/5 | Added 3 new operations with properly conditioned input fields. Each operation has appropriate UI controls (dropdowns, sliders, text inputs) with sensible defaults. |
Sequence Diagram
sequenceDiagram
participant User
participant YouTubeBlock
participant Tool
participant YouTubeAPI
alt Search Videos (Enhanced)
User->>YouTubeBlock: Select youtube_search operation
User->>YouTubeBlock: Enter query + filters (channel, dates, duration, etc.)
YouTubeBlock->>Tool: youtube_search(query, filters, apiKey)
Tool->>YouTubeAPI: GET /search?q=query&channelId=...&publishedAfter=...
YouTubeAPI-->>Tool: Search results
Tool-->>YouTubeBlock: {items[], totalResults, nextPageToken}
end
alt Get Channel Videos (New)
User->>YouTubeBlock: Select youtube_channel_videos operation
User->>YouTubeBlock: Enter channelId + sort order
YouTubeBlock->>Tool: youtube_channel_videos(channelId, order, apiKey)
Tool->>YouTubeAPI: GET /search?channelId=...&type=video&order=...
YouTubeAPI-->>Tool: Channel videos
Tool-->>YouTubeBlock: {items[], totalResults, nextPageToken}
end
alt Get Channel Playlists (New)
User->>YouTubeBlock: Select youtube_channel_playlists operation
User->>YouTubeBlock: Enter channelId
YouTubeBlock->>Tool: youtube_channel_playlists(channelId, apiKey)
Tool->>YouTubeAPI: GET /playlists?channelId=...&part=snippet,contentDetails
YouTubeAPI-->>Tool: Channel playlists
Tool-->>YouTubeBlock: {items[], totalResults, nextPageToken}
end
alt Get Related Videos (New)
User->>YouTubeBlock: Select youtube_related_videos operation
User->>YouTubeBlock: Enter videoId
YouTubeBlock->>Tool: youtube_related_videos(videoId, apiKey)
Tool->>YouTubeAPI: GET /search?relatedToVideoId=...&type=video
YouTubeAPI-->>Tool: Related videos
Tool-->>YouTubeBlock: {items[], totalResults, nextPageToken}
end
9 files reviewed, no comments
…lists videos and related videos tools (#1814)
Summary
Fixes #1793
Type of Change
Testing
Tested manually
Checklist