mirror of
https://github.com/kevinwatt/yt-dlp-mcp.git
synced 2025-08-10 16:09:14 +03:00
- Add new search_videos tool for YouTube video search - Support configurable search result count (1-50) - Return formatted results with title, channel, duration, and URL - Add comprehensive test coverage with real yt-dlp integration - Update documentation with search examples - Fix dependency security vulnerabilities - Bump version to 0.6.27 Resolves: kevinwatt/yt-dlp-mcp#14
2.6 KiB
2.6 KiB
Search Feature Demo
The search functionality has been successfully added to yt-dlp-mcp! This feature allows you to search for videos on YouTube using keywords and get formatted results with video information.
New Tool: search_videos
Description
Search for videos on YouTube using keywords. Returns title, uploader, duration, and URL for each result.
Parameters
query(string, required): Search keywords or phrasemaxResults(number, optional): Maximum number of results to return (1-50, default: 10)
Example Usage
Ask your LLM to:
"Search for Python tutorial videos"
"Find JavaScript courses and show me the top 5 results"
"Search for machine learning tutorials with 15 results"
Example Output
When searching for "javascript tutorial" with 3 results, you'll get:
Found 3 videos:
1. **JavaScript Tutorial Full Course - Beginner to Pro**
📺 Channel: Traversy Media
⏱️ Duration: 15663
🔗 URL: https://www.youtube.com/watch?v=EerdGm-ehJQ
🆔 ID: EerdGm-ehJQ
2. **JavaScript Course for Beginners**
📺 Channel: FreeCodeCamp.org
⏱️ Duration: 12402
🔗 URL: https://www.youtube.com/watch?v=W6NZfCO5SIk
🆔 ID: W6NZfCO5SIk
3. **JavaScript Full Course for free 🌐 (2024)**
📺 Channel: Bro Code
⏱️ Duration: 43200
🔗 URL: https://www.youtube.com/watch?v=lfmg-EJ8gm4
🆔 ID: lfmg-EJ8gm4
💡 You can use any URL to download videos, audio, or subtitles!
Integration with Existing Features
After searching for videos, you can directly use the returned URLs with other tools:
- Download video: Use the URL with
download_video - Download audio: Use the URL with
download_audio - Get subtitles: Use the URL with
list_subtitle_languagesordownload_video_subtitles - Get transcript: Use the URL with
download_transcript
Test Results
All search functionality tests pass:
- ✅ Successfully search and format results
- ✅ Reject empty search queries
- ✅ Validate maxResults parameter range
- ✅ Handle search with different result counts
- ✅ Return properly formatted results
- ✅ Handle obscure search terms gracefully
Implementation Details
The search feature uses yt-dlp's built-in search capability with the syntax:
ytsearch[N]:[query]where N is the number of results- Uses
--printoptions to extract: title, id, uploader, duration - Results are formatted in a user-friendly way with emojis and clear structure
This addresses the feature request from Issue #14 and provides a seamless search experience for users.