### Install Python Dependencies Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/README.md Install the required Python packages using pip or uv. Ensure you have Python 3.8 or higher installed. ```bash pip install -r requirements.txt ``` ```bash uv install ``` -------------------------------- ### Install Dependencies and Configure API Key Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Installs necessary Python packages and sets the YouTube API key as an environment variable. Ensure you replace 'your_youtube_api_key_here' with your actual key. ```bash # Install dependencies pip install mcp[cli] python-dotenv google-api-python-client pydantic youtube_transcript_api # Or using requirements.txt pip install -r requirements.txt # Set up environment variable export YOUTUBE_API_KEY=your_youtube_api_key_here ``` -------------------------------- ### Fetch YouTube Video Transcript Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/notebooks/fetch_transcipts.ipynb Use this snippet to fetch the transcript of a YouTube video given its ID. Ensure you have the youtube-transcript-api library installed. The output is a list of transcript snippets with text, start time, and duration. ```python from youtube_transcript_api import YouTubeTranscriptApi video_id = "BimXIWz5Wi8" ytt_api = YouTubeTranscriptApi() transcript = ytt_api.fetch(video_id = video_id) print(transcript) ``` -------------------------------- ### Retrieve YouTube Playlist Metrics Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Get statistics for a specific YouTube playlist, including the number of videos and total view count. ```python from tools.get_playlist_metrics import get_playlist_metrics # Get metrics for a specific playlist result = get_playlist_metrics({ "playlist_id": "PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU" # Required: YouTube playlist ID }) ``` -------------------------------- ### GET /get_playlist_metrics Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/README.md Retrieves statistics for a specific YouTube playlist, including item count and total view count of all videos. ```APIDOC ## GET /get_playlist_metrics ### Description Retrieves statistics for a specific YouTube playlist, including item count and total view count of all videos. ### Method GET ### Endpoint /get_playlist_metrics ### Parameters #### Query Parameters - **playlist_id** (string) - Required - The YouTube playlist ID ### Request Example GET /get_playlist_metrics?playlist_id=PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU ### Response #### Success Response (200) - **item_count** (integer) - The number of videos in the playlist - **view_count** (integer) - The total view count of all videos in the playlist #### Response Example { "item_count": 50, "view_count": 1000000 } ``` -------------------------------- ### Retrieve YouTube Channel Metrics Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Get statistics for a specific YouTube channel using its ID. Includes subscriber count, total views, and video count. ```python from tools.get_channel_metrics import get_channel_metrics # Get metrics for a specific channel result = get_channel_metrics({ "channel_id": "UC_x5XG1OV2P6uZZ5FSM9Ttw" # Required: YouTube channel ID }) ``` -------------------------------- ### Custom YouTube API Error Handling Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Defines a custom exception class for YouTube API errors and a function to get a singleton YouTube API client. Includes error handling for common API issues. ```python from utils.tool_utils import YouTubeAPIError, get_youtube_client from googleapiclient.errors import HttpError import os from googleapiclient.discovery import build class YouTubeAPIError(Exception): """Custom exception for YouTube API errors""" pass def get_youtube_client(): """Get a singleton YouTube API client instance.""" api_key = os.getenv('YOUTUBE_API_KEY') if not api_key: raise YouTubeAPIError("YouTube API key is not set in environment variables") if not hasattr(get_youtube_client, 'client'): get_youtube_client.client = build('youtube', 'v3', developerKey=api_key) return get_youtube_client.client ``` -------------------------------- ### Retrieve YouTube Video Metrics Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Get statistics for a specific YouTube video using its ID. Useful for analyzing individual video performance. ```python from tools.get_video_metrics import get_video_metrics # Get metrics for a specific video result = get_video_metrics({ "video_id": "dQw4w9WgXcQ" # Required: YouTube video ID }) ``` -------------------------------- ### GET /get_video_metrics Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/README.md Retrieves statistics for a specific YouTube video, including view count, like count, and comment count. ```APIDOC ## GET /get_video_metrics ### Description Retrieves statistics for a specific YouTube video, including view count, like count, and comment count. ### Method GET ### Endpoint /get_video_metrics ### Parameters #### Query Parameters - **video_id** (string) - Required - The YouTube video ID ### Request Example GET /get_video_metrics?video_id=dQw4w9WgXcQ ### Response #### Success Response (200) - **view_count** (integer) - The number of views for the video - **like_count** (integer) - The number of likes for the video - **comment_count** (integer) - The number of comments for the video #### Response Example { "view_count": 1000000, "like_count": 50000, "comment_count": 1000 } ``` -------------------------------- ### GET /get_channel_metrics Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/README.md Retrieves statistics for a specific YouTube channel, including subscriber count, total view count, and video count. ```APIDOC ## GET /get_channel_metrics ### Description Retrieves statistics for a specific YouTube channel, including subscriber count, total view count, and video count. ### Method GET ### Endpoint /get_channel_metrics ### Parameters #### Query Parameters - **channel_id** (string) - Required - The YouTube channel ID ### Request Example GET /get_channel_metrics?channel_id=UC_x5XG1OV2P6uZZ5FSM9Ttw ### Response #### Success Response (200) - **subscriber_count** (integer) - The number of subscribers for the channel - **video_count** (integer) - The number of videos on the channel - **view_count** (integer) - The total number of views for all videos on the channel #### Response Example { "subscriber_count": 1000000, "video_count": 500, "view_count": 100000000 } ``` -------------------------------- ### Get Channel Metrics Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Retrieve comprehensive statistics for a specific YouTube channel by ID, including subscriber count, total lifetime views, and total video count. ```APIDOC ## GET /channel/metrics ### Description Retrieve comprehensive statistics for a specific YouTube channel by ID. ### Method GET ### Endpoint /channel/metrics ### Parameters #### Query Parameters - **channel_id** (string) - Required - The YouTube channel ID. ### Response #### Success Response (200) - **channel_name** (string) - The name of the channel. - **subscribers** (integer) - The total number of subscribers. - **total_views** (integer) - The total lifetime views for the channel. - **total_videos** (integer) - The total number of videos uploaded by the channel. ### Response Example ```json { "channel_name": "Google Developers", "subscribers": 2500000, "total_views": 350000000, "total_videos": 5200 } ``` ``` -------------------------------- ### Get Video Metrics Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Retrieve detailed statistics for a specific YouTube video by ID, including view count, like count, and comment count. Useful for analyzing individual video performance. ```APIDOC ## GET /video/metrics ### Description Retrieve detailed statistics for a specific YouTube video by ID. ### Method GET ### Endpoint /video/metrics ### Parameters #### Query Parameters - **video_id** (string) - Required - The YouTube video ID. ### Response #### Success Response (200) - **title** (string) - The title of the video. - **views** (integer) - The total view count for the video. - **likes** (integer) - The total like count for the video. - **comments** (integer) - The total comment count for the video. ### Response Example ```json { "title": "Never Gonna Give You Up", "views": 1500000000, "likes": 15000000, "comments": 3200000 } ``` ``` -------------------------------- ### Clone Repository and Navigate Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/README.md Clone the project repository and navigate into the project directory. This is the initial step for setting up the server. ```bash git clone https://github.com/NastyRunner13/youtube-content-management-mcp cd youtube-content-management-mcp ``` -------------------------------- ### Initialize YouTube API Client Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/notebooks/youtube_serach.ipynb Sets up the YouTube API client using an API key from environment variables. Includes error handling for missing keys and uses a module-level singleton for the client instance. ```python import os from dotenv import load_dotenv from googleapiclient.discovery import build from googleapiclient.errors import HttpError from mcp.types import TextContent load_dotenv() class YouTubeAPIError(Exception): """Custom exception for YouTube API errors""" pass api_key = os.getenv('YOUTUBE_API_KEY') if not api_key: raise YouTubeAPIError("YouTube API key is not set in environment variables") def get_youtube_client(): """Get a singleton YouTube API client instance.""" api_key = os.getenv('YOUTUBE_API_KEY') if not api_key: raise YouTubeAPIError("YouTube API key is not set in environment variables") # Cache the client instance (module-level singleton) if not hasattr(get_youtube_client, 'client'): get_youtube_client.client = build('youtube', 'v3', developerKey=api_key) return get_youtube_client.client ``` -------------------------------- ### Configure VSCode MCP Server (Standard) Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/README.md Configure the MCP server in VSCode's settings.json for standard Python execution. Replace '/path/to/' with the actual path to your cloned repository. ```json { "mcp.servers": { "youtube-content-management": { "command": "python", "args": [ "/path/to/youtube-content-management-mcp/main.py" ], "env": { "YOUTUBE_API_KEY": "your_youtube_api_key_here" } } } } ``` -------------------------------- ### Configure VSCode MCP Server (uv) Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/README.md Configure the MCP server in VSCode's settings.json using 'uv' for execution. This is an alternative to direct Python execution. Replace '/path/to/' with the actual path to your cloned repository. ```json { "mcp.servers": { "youtube-content-management": { "command": "uv", "args": [ "--directory", "/path/to/youtube-content-management-mcp", "run", "main.py" ], "env": { "YOUTUBE_API_KEY": "your_youtube_api_key_here" } } } } ``` -------------------------------- ### Claude Desktop MCP Server Configuration Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Sets up the YouTube Content Management MCP server for Claude Desktop. This JSON configuration file specifies the command to run the Python script and necessary environment variables, including your YouTube API key. ```json // Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json) { "mcpServers": { "youtube-content-management": { "command": "python", "args": ["/path/to/youtube-content-management-mcp/main.py"], "env": { "YOUTUBE_API_KEY": "your_youtube_api_key_here" } } } } ``` -------------------------------- ### Search YouTube Videos with Python Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/notebooks/youtube_serach.ipynb Use this snippet to search for YouTube videos based on a query and other parameters. Ensure you have a YouTube client initialized. ```python youtube = get_youtube_client() arguments = { "query": "python tutorial", "max_results": 10, "duration": "short", "published_after": "2025-01-01T00:00:00Z" } query = arguments.get("query", "") max_results = min(arguments.get("max_results", 25), 50) response = youtube.search().list( part='snippet', q=query, type='video', maxResults=max_results ).execute() ``` -------------------------------- ### Configure Claude Desktop MCP Server Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/README.md Add this JSON configuration to your Claude Desktop config file to connect to the MCP server. Ensure the path to main.py is correct. ```json { "mcpServers": { "youtube-content-management": { "command": "python", "args": ["/path/to/youtube-content-management-mcp/main.py"], "env": { "YOUTUBE_API_KEY": "your_youtube_api_key_here" } } } } ``` -------------------------------- ### Enable Debug Mode for YouTube Content Management MCP Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/README.md To enable debug logging, set the 'DEBUG' environment variable to 'true'. Ensure your 'YOUTUBE_API_KEY' is also configured. ```json { "env": { "YOUTUBE_API_KEY": "your_key_here", "DEBUG": "true" } } ``` -------------------------------- ### Pydantic Model for Fetch Transcripts Input Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Input model for fetching transcripts, accepting video ID or URL, and an optional language code. Includes Pydantic validation. ```python from pydantic import BaseModel, Field, field_validator from typing import Optional # Transcript input with URL parsing class FetchTranscriptsInput(BaseModel): video_id: Optional[str] = Field(None, min_length=1) video_url: Optional[str] = Field(None) # Auto-extracts video_id language_code: Optional[str] = Field("en") # ISO 639-1 code ``` -------------------------------- ### Pydantic Models for Metrics Input Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Input models for retrieving metrics, requiring specific IDs for videos, channels, or playlists. Utilizes Pydantic for validation. ```python from pydantic import BaseModel, Field, field_validator from typing import Optional # Metrics input models class VideoIdInput(BaseModel): video_id: str = Field(..., min_length=1) class ChannelIdInput(BaseModel): channel_id: str = Field(..., min_length=1) class PlaylistIdInput(BaseModel): playlist_id: str = Field(..., min_length=1) ``` -------------------------------- ### VSCode MCP Server Configuration Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Configures the YouTube Content Management MCP server within VSCode's settings.json. This allows VSCode to connect to the MCP server using Python. Remember to update the path to your script and API key. ```json // VSCode settings.json configuration { "mcp.servers": { "youtube-content-management": { "command": "python", "args": ["/path/to/youtube-content-management-mcp/main.py"], "env": { "YOUTUBE_API_KEY": "your_youtube_api_key_here" } } } } ``` -------------------------------- ### Pydantic Model for Video Search Input Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Defines the input structure for searching videos, including query, max results, order, duration, and published after date. Uses Pydantic for validation. ```python from pydantic import BaseModel, Field, field_validator from typing import Optional # Video search input validation class SearchVideosInput(BaseModel): query: str = Field(..., min_length=1, description="Search query (required)") max_results: Optional[int] = Field(25, ge=1, le=50) order: Optional[str] = Field("relevance") # relevance|date|rating|viewCount duration: Optional[str] = Field("medium") # medium|long published_after: Optional[str] = Field(None) # RFC 3339: 2023-01-01T00:00:00Z ``` -------------------------------- ### Fetch YouTube Video Transcripts Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Retrieve complete video transcripts for analysis. Supports fetching by video ID or URL, and allows specifying the language. ```python from tools.fetch_transcripts import fetch_transcripts # Fetch transcript by video ID result = fetch_transcripts({ "video_id": "dQw4w9WgXcQ" }) ``` ```python # Fetch transcript by URL result = fetch_transcripts({ "video_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }) ``` ```python # Fetch transcript in specific language result = fetch_transcripts({ "video_id": "dQw4w9WgXcQ", "language_code": "es" # Spanish, default: "en" }) ``` -------------------------------- ### Pydantic Model for Channel/Playlist Search Input Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Defines the input structure for searching channels or playlists, including query, max results, and published after date. Uses Pydantic for validation. ```python from pydantic import BaseModel, Field, field_validator from typing import Optional # Channel/Playlist search input class SearchChannelsInput(BaseModel): query: str = Field(..., min_length=1) max_results: Optional[int] = Field(25, ge=1, le=50) published_after: Optional[str] = Field(None) ``` -------------------------------- ### Display Search Results Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/notebooks/youtube_serach.ipynb Prints the processed search results, which are a list of TextContent objects, each containing information about a YouTube video. ```python results ``` -------------------------------- ### Fetch Transcripts Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Retrieve complete video transcripts for content analysis, summarization, or extracting specific information. Supports multiple languages and accepts either video ID or full YouTube URL. ```APIDOC ## GET /transcripts ### Description Retrieve complete video transcripts. ### Method GET ### Endpoint /transcripts ### Parameters #### Query Parameters - **video_id** (string) - Optional - The YouTube video ID. - **video_url** (string) - Optional - The full YouTube URL of the video. The video ID will be extracted from the URL. - **language_code** (string) - Optional - The ISO 639-1 code for the desired language (default: "en"). ### Request Body *Note: Provide either `video_id` or `video_url`.* ### Response #### Success Response (200) - **transcript** (string) - The full transcript of the video in the specified language. ### Response Example ```json { "transcript": "Transcript for video ID dQw4w9WgXcQ (language: en):\n\nWe're no strangers to love You know the rules and so do I..." } ``` ``` -------------------------------- ### Search YouTube Playlists Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Searches for YouTube playlists using a query string. Filters can be applied to limit the number of results and specify a minimum creation date. The output includes playlist details such as title, ID, and description. ```python from tools.search_playlists import search_playlists # Search for playlists result = search_playlists({ "query": "Python beginner course" }) # Search with filters result = search_playlists({ "query": "web development bootcamp", "max_results": 20, # 1-50, default: 25 "published_after": "2024-01-01T00:00:00Z" # Filter by creation date }) # Example response format: # Found 20 playlists: # # **Complete Python Bootcamp** ``` -------------------------------- ### POST /search_playlists Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/README.md Searches YouTube for playlists based on search queries. ```APIDOC ## POST /search_playlists ### Description Searches YouTube for playlists based on search queries. ### Method POST ### Endpoint /search_playlists ### Parameters #### Query Parameters - **query** (string) - Required - Search query for playlists - **max_results** (integer) - Optional - Maximum number of results (1-50, default: 25) - **published_after** (string) - Optional - RFC 3339 timestamp (e.g., "2023-01-01T00:00:00Z") ### Request Example { "query": "machine learning", "max_results": 10 } ### Response #### Success Response (200) - **playlists** (array) - List of playlist search results #### Response Example { "playlists": [ { "id": "PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU", "title": "Example Playlist", "item_count": 50, "view_count": 1000000 } ] } ``` -------------------------------- ### POST /search_channels Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/README.md Finds YouTube channels based on search queries, including metrics like subscriber count, video count, and total view count. ```APIDOC ## POST /search_channels ### Description Finds YouTube channels based on search queries, including metrics like subscriber count, video count, and total view count. ### Method POST ### Endpoint /search_channels ### Parameters #### Query Parameters - **query** (string) - Required - Search query for channels - **max_results** (integer) - Optional - Maximum number of results (1-50, default: 25) - **published_after** (string) - Optional - RFC 3339 timestamp (e.g., "2023-01-01T00:00:00Z") ### Request Example { "query": "coding tutorials", "max_results": 10 } ### Response #### Success Response (200) - **channels** (array) - List of channel search results #### Response Example { "channels": [ { "id": "UC_x5XG1OV2P6uZZ5FSM9Ttw", "title": "Example Channel", "subscriber_count": 1000000, "video_count": 500, "view_count": 100000000 } ] } ``` -------------------------------- ### Search YouTube Videos Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/notebooks/youtube_serach.ipynb Performs a search on YouTube using specified arguments and processes the results. Handles API errors and unexpected exceptions. The search parameters include query, max results, order, duration, and published after date. ```python arguments = { "query": "AI", "max_results": 10, "order": "viewCount", "published_after": "2025-01-01T00:00:00Z" } youtube = get_youtube_client() try: query = arguments.get("query", "") max_results = min(arguments.get("max_results", 25), 50) # API limit order = arguments.get("order", "relevance") duration = arguments.get("duration", "medium") upload_date = arguments.get("published_after", None) search_params = { 'part': 'snippet', 'q': query, 'type': 'video', 'maxResults': max_results, 'order': order } if duration != "any": search_params['videoDuration'] = duration if upload_date: search_params['publishedAfter'] = upload_date response = youtube.search().list(**search_params).execute() results = [] for item in response.get('items', []): description = item['snippet']['description'] truncated_desc = description[:200] + ('...' if description else '') video_info = { 'video_id': item['id']['videoId'], 'title': item['snippet']['title'], 'description': truncated_desc, 'channel_title': item['snippet']['channelTitle'], 'published_at': item['snippet']['publishedAt'], 'thumbnail_url': item['snippet']['thumbnails'].get('default', {}).get('url', '') } # Create one TextContent per video results.append(TextContent( type="text", text=(f"**{video_info['title']}**\n" f"Channel: {video_info['channel_title']}\n" f"Video ID: {video_info['video_id']}\n" f"Published: {video_info['published_at']}\n" f"Description: {video_info['description']}") )) except HttpError as e: raise YouTubeAPIError(f"YouTube API error for query '{query}': {e}") except Exception as e: raise YouTubeAPIError(f"Unexpected error for query '{query}': {e}") ``` -------------------------------- ### POST /search_videos Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/README.md Searches YouTube for videos with advanced filtering options, including metrics like view count, like count, and comment count. ```APIDOC ## POST /search_videos ### Description Searches YouTube for videos with advanced filtering options, including metrics like view count, like count, and comment count. ### Method POST ### Endpoint /search_videos ### Parameters #### Query Parameters - **query** (string) - Required - Search query - **max_results** (integer) - Optional - Maximum number of results (1-50, default: 25) - **order** (string) - Optional - Sort order - "relevance", "date", "rating", "viewCount" (default: "relevance") - **duration** (string) - Optional - Video duration - "medium", "long" (default: "medium") - **published_after** (string) - Optional - RFC 3339 timestamp (e.g., "2023-01-01T00:00:00Z") ### Request Example { "query": "Python tutorials", "max_results": 10, "order": "viewCount", "published_after": "2023-01-01T00:00:00Z" } ### Response #### Success Response (200) - **videos** (array) - List of video search results - **channels** (array) - List of channel search results - **playlists** (array) - List of playlist search results #### Response Example { "videos": [ { "id": "dQw4w9WgXcQ", "title": "Example Video", "view_count": 1000000, "like_count": 50000, "comment_count": 1000 } ] } ``` -------------------------------- ### Concatenate Transcript Snippets to Full Transcript Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/notebooks/fetch_transcipts.ipynb Combines individual transcript snippets into a single string representing the full video transcript. This is useful for further text processing or analysis. ```python video_transcript = "".join(snippet.text for snippet in transcript.snippets) print(video_transcript) ``` -------------------------------- ### Fetch YouTube Video Details by ID Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/notebooks/youtube_serach.ipynb Use this snippet to retrieve detailed information about a specific YouTube video using its ID. It fetches snippet and statistics parts of the video data. ```python response = youtube.videos().list( part='snippet,statistics', id="_uQrJ0TkZlc" ).execute() items = response.get('items', []) item = items[0] item ``` -------------------------------- ### Search YouTube Videos Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Searches YouTube for videos. The basic search requires only a query. Advanced searches can filter by maximum results, order, duration (medium/long), and publication date. Short videos are excluded by default. ```python from tools.search_videos import search_videos # Basic video search result = search_videos({ "query": "Python machine learning tutorial" }) # Returns: List of TextContent with video details and metrics # Advanced search with all filters result = search_videos({ "query": "React hooks tutorial", "max_results": 10, # 1-50, default: 25 "order": "viewCount", # relevance|date|rating|viewCount "duration": "long", # medium|long (excludes shorts) "published_after": "2024-01-01T00:00:00Z" # RFC 3339 timestamp }) # Example response format per video: # **Complete React Hooks Tutorial** # Channel: Tech Academy # Video ID: abc123xyz # Published: 2024-03-15T10:30:00Z # Views: 1,250,000 # Likes: 45,000 # Comments: 2,300 # Description: Learn all React hooks from scratch... ``` -------------------------------- ### Display YouTube API Search Response Source: https://github.com/nastyrunner13/youtube-content-management-mcp/blob/main/notebooks/youtube_serach.ipynb This snippet simply displays the raw response object received from the YouTube API search query. ```python response ``` -------------------------------- ### Search YouTube Channels Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Finds YouTube channels based on a query. Results can be filtered by the maximum number of results and the channel's creation date. The tool automatically retrieves channel statistics like subscriber count and total views. ```python from tools.search_channels import search_channels # Basic channel search result = search_channels({ "query": "programming tutorials" }) # Filtered channel search with date restriction result = search_channels({ "query": "machine learning education", "max_results": 15, # 1-50, default: 25 "published_after": "2023-01-01T00:00:00Z" # Filter by channel creation date }) # Example response format: # Found 15 channels: # # **Tech With Tim** # Channel ID: UC4JX40jDee_tINbkjycV4Sg # Created: 2014-05-22T15:30:00Z # Subscribers: 1,200,000 # Videos: 850 # Total Views: 150,000,000 # Description: Programming tutorials and tech content... ``` -------------------------------- ### Search Playlists API Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Searches YouTube for playlists based on a query string with optional date filtering. Returns playlist title, ID, creation date, and description. ```APIDOC ## POST /api/search_playlists ### Description Searches YouTube for playlists based on a query string with optional date filtering. Returns playlist title, ID, creation date, and description for organizing content discovery. ### Method POST ### Endpoint /api/search_playlists ### Parameters #### Request Body - **query** (string) - Required - The search query string. - **max_results** (integer) - Optional - The maximum number of results to return (1-50, default: 25). - **published_after** (string) - Optional - Filter by playlist creation date (RFC 3339 timestamp format, e.g., "2024-01-01T00:00:00Z"). ### Request Example ```json { "query": "web development bootcamp", "max_results": 20, "published_after": "2024-01-01T00:00:00Z" } ``` ### Response #### Success Response (200) - **playlists** (array) - A list of playlist objects, each containing: - **title** (string) - The title of the playlist. - **playlist_id** (string) - The unique ID of the playlist. - **published_at** (string) - The playlist creation date in RFC 3339 format. - **description** (string) - The playlist description. #### Response Example ```json { "playlists": [ { "title": "Complete Python Bootcamp", "playlist_id": "PLabcdef12345", "published_at": "2024-02-20T14:00:00Z", "description": "A comprehensive course for Python beginners." } ] } ``` ``` -------------------------------- ### Search Channels API Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Finds YouTube channels based on search queries with automatic metrics retrieval including subscriber count, total video count, and lifetime view count. ```APIDOC ## POST /api/search_channels ### Description Finds YouTube channels based on search queries with automatic metrics retrieval including subscriber count, total video count, and lifetime view count. Results are formatted with channel details and statistics for easy comparison. ### Method POST ### Endpoint /api/search_channels ### Parameters #### Request Body - **query** (string) - Required - The search query string. - **max_results** (integer) - Optional - The maximum number of results to return (1-50, default: 25). - **published_after** (string) - Optional - Filter by channel creation date (RFC 3339 timestamp format, e.g., "2023-01-01T00:00:00Z"). ### Request Example ```json { "query": "machine learning education", "max_results": 15, "published_after": "2023-01-01T00:00:00Z" } ``` ### Response #### Success Response (200) - **channels** (array) - A list of channel objects, each containing: - **title** (string) - The title of the channel. - **channel_id** (string) - The unique ID of the channel. - **created_at** (string) - The channel creation date in RFC 3339 format. - **subscribers** (integer) - The number of subscribers. - **videos** (integer) - The total number of videos. - **total_views** (integer) - The total lifetime view count. - **description** (string) - The channel description. #### Response Example ```json { "channels": [ { "title": "Tech With Tim", "channel_id": "UC4JX40jDee_tINbkjycV4Sg", "created_at": "2014-05-22T15:30:00Z", "subscribers": 1200000, "videos": 850, "total_views": 150000000, "description": "Programming tutorials and tech content..." } ] } ``` ``` -------------------------------- ### Search Videos API Source: https://context7.com/nastyrunner13/youtube-content-management-mcp/llms.txt Searches YouTube for videos based on a query with advanced filtering options. Results include video details and real-time metrics. Short videos are excluded by default. ```APIDOC ## POST /api/search_videos ### Description Searches YouTube for videos with advanced filtering options including sort order, duration filter, and date restrictions. Each result includes video title, channel, video ID, publication date, description, and real-time metrics (views, likes, comments) fetched automatically. Short videos under 4 minutes are excluded by default. ### Method POST ### Endpoint /api/search_videos ### Parameters #### Request Body - **query** (string) - Required - The search query string. - **max_results** (integer) - Optional - The maximum number of results to return (1-50, default: 25). - **order** (string) - Optional - The order of the search results (relevance|date|rating|viewCount). - **duration** (string) - Optional - Filter by video duration (medium|long, excludes shorts). - **published_after** (string) - Optional - Filter by publication date (RFC 3339 timestamp format, e.g., "2024-01-01T00:00:00Z"). ### Request Example ```json { "query": "Python machine learning tutorial", "max_results": 10, "order": "viewCount", "duration": "long", "published_after": "2024-01-01T00:00:00Z" } ``` ### Response #### Success Response (200) - **videos** (array) - A list of video objects, each containing: - **title** (string) - The title of the video. - **channel** (string) - The name of the channel. - **video_id** (string) - The unique ID of the video. - **published_at** (string) - The publication date in RFC 3339 format. - **description** (string) - The video description. - **view_count** (integer) - The number of views. - **like_count** (integer) - The number of likes. - **comment_count** (integer) - The number of comments. #### Response Example ```json { "videos": [ { "title": "Complete React Hooks Tutorial", "channel": "Tech Academy", "video_id": "abc123xyz", "published_at": "2024-03-15T10:30:00Z", "description": "Learn all React hooks from scratch...", "view_count": 1250000, "like_count": 45000, "comment_count": 2300 } ] } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.