Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • added additional youtube search params, get channel playlists videos and related videos tools

Fixes #1793

Type of Change

  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Nov 5, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs Ready Ready Preview Comment Nov 5, 2025 7:23pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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_search with 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_videos tool to retrieve all videos from a specific channel with sorting options
  • Added youtube_channel_playlists tool to get all playlists from a channel
  • Added youtube_related_videos tool 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 pageToken and nextPageToken

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/publishedBefore parameters

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
Loading

9 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit 2056e8a into staging Nov 5, 2025
9 checks passed
@waleedlatif1 waleedlatif1 deleted the sim-344 branch November 5, 2025 19:26
@waleedlatif1 waleedlatif1 mentioned this pull request Nov 5, 2025
10 tasks
waleedlatif1 added a commit that referenced this pull request Nov 12, 2025
@waleedlatif1 waleedlatif1 mentioned this pull request Nov 12, 2025
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants