Skip to main content
Glama

get_transcript

Extract and retrieve the transcript of a YouTube video by providing its URL, enabling access to video content for translation, summarization, or analysis.

Instructions

Get the transcript of a YouTube video

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes

Implementation Reference

  • The main handler function for the 'get_transcript' tool. It processes a YouTube video URL, calls process_video to prepare it, fetches the transcript via make_yt_api_request, and handles various response formats or errors.
    async def get_transcript(url: str) -> str: """Get the transcript of a YouTube video. This tool processes a video and retrieves its transcript. It can efficiently handle YouTube URLs by extracting the video ID and checking if it's already been processed before submitting a new request. Args: url: The YouTube video URL Returns: The video transcript as text """ logger.info(f"Getting transcript for URL: {url}") # Process the video to ensure it's ready success, video_id, error_message = await process_video(url) if not success: logger.error(f"Failed to process video: {error_message}") return f"Error: {error_message}" # Get the transcript from the API transcript_response = await make_yt_api_request(f"/api/videos/{video_id}/transcript") if not transcript_response: error_msg = "Failed to retrieve transcript." logger.error(error_msg) return f"Error: {error_msg}" # Check if the response is a string or a JSON object if isinstance(transcript_response, str): return transcript_response elif isinstance(transcript_response, dict) and "transcript" in transcript_response: return transcript_response["transcript"]["text"] else: error_msg = "Unexpected response format from API." logger.error(error_msg) return f"Error: {error_msg}"
  • The MCP tool registration decorator that registers the get_transcript function with name 'get_transcript' and its description.
    @mcp_server.tool(name="get_transcript", description="Get the transcript of a YouTube video")

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/brianshin22/youtube-translate-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server