Sponsored by Deepsite.site

Youtube2text

Created By
Dmitry Nosov4 months ago
Content

YouTube2Text API Usage Guide YouTube2Text is a utility for extracting bare text transcriptions from YouTube videos (without subtitle timecodes and any other metadata) for analytics, insights, summaries, content generation, and other text processing applications.

Getting Started To get started quickly, you can obtain a demo API key by visiting https://api.youtube2text.org. However, demo keys rotate frequently and have limited usage quotas. For production use or regular usage, consider subscribing to one of the available plans for a stable, dedicated API key with higher quotas.

Direct API Usage The YouTube2Text API is available at https://api.youtube2text.org. The primary endpoint for transcription is /transcribe.

Basic CURL Request Basic API Call curl -X POST https://api.youtube2text.org/transcribe
-H "Content-Type: application/json"
-H "x-api-key: YT2TEXT_API_KEY"
-d '{ "url": "https://www.youtube.com/watch?v=VIDEO_ID" }' Input Parameters url (required): The full YouTube video URL; maxChars (optional): Maximum characters to return (defaults to 150,000)

Response Structure Success Response (200) Success Response { "result": { "videoId": "VIDEO_ID", "title": "Video Title", "pubDate": "2025-06-30T08:45:04-07:00", "content": "The full video transcription text without timestamps...", "contentSize": 12345, "truncated": false } } Error Response (400/401/404/429/500) Error Response { "error": { "code": "ERROR_CODE", "message": "Error description", "status": 400, "retryAfterSeconds": 3600, "details": "Additional error details" } } Response Codes 200: Success - transcription retrieved 400: Bad Request - invalid URL or validation error 401: Unauthorized - invalid or missing API key 404: Not Found - video not found or transcript unavailable 429: Rate Limited - quota exceeded or too many requests 500: Internal Server Error - server-side issue Error Codes VALIDATION_ERROR: Invalid URL or missing parameters UNAUTHORIZED: Invalid or expired API key VIDEO_NOT_FOUND: YouTube video not found TRANSCRIPT_UNAVAILABLE: No transcript available for this video INVALID_URL: Malformed YouTube URL RATE_LIMIT_EXCEEDED: Monthly quota exceeded or rate limited INTERNAL_ERROR: Server-side error MCP Integration YouTube2Text supports Model Context Protocol (MCP) for seamless integration with various AI models.

Anthropic Claude Claude MCP Integration import anthropic from anthropic.types.beta import BetaRequestMCPServerURLDefinitionParam, BetaMessageParam

default_key = "ANTHROPIC_API_KEY" client = anthropic.Anthropic(api_key=default_key) server = BetaRequestMCPServerURLDefinitionParam( name="youtube2text", type="url", url="https://api.youtube2text.org/mcp", authorization_token="YT2TEXT_API_KEY" )

prompt_message = BetaMessageParam(role="user", content="Please use the tools from the remote MCP server to help me. Provide the transcription of https://www.youtube.com/watch?v=DCv5p_eJTlU")

response = client.beta.messages.create( model="claude-sonnet-4-20250514", max_tokens=10000, messages=[prompt_message], # Direct MCP server connection - no manual tool definition needed! mcp_servers=[server], # Required beta header for MCP connector extra_headers={ "anthropic-beta": "mcp-client-2025-04-04", } )

print(response.content) OpenAI OpenAI MCP Integration from openai import OpenAI from openai.types.responses.tool_param import Mcp import os

os.environ["OPENAI_API_KEY"] = "OPENAI_API_KEY"

client = OpenAI()

youtube_transcribe_mcp = Mcp( type="mcp", server_label="youtube2text", server_url="https://api.youtube2text.org/mcp", require_approval="never", headers={"Authorization": "Bearer YT2TEXT_API_KEY"} )

resp = client.responses.create( model="gpt-4.1", tools=[youtube_transcribe_mcp], input="Please use the tools from the remote MCP server to help me. Provide the transcription of https://www.youtube.com/watch?v=DCv5p_eJTlU", )

print(resp.output_text) Google Gemini Gemini Integration import google.generativeai as genai import requests

genai.configure(api_key="GEMINI_API_KEY")

YOUTUBE_TRANSCRIPT_API_URL = "https://api.youtube2text.org/mcp" YOUTUBE_TRANSCRIPT_API_TOKEN = "YT2TEXT_API_KEY"

Define the External Tool (Function)

def get_youtube_transcription(video_url: str): """ Retrieves the transcription of a YouTube video from a given URL.

Args:
    video_url: The full URL of the YouTube video.
"""
headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {YOUTUBE_TRANSCRIPT_API_TOKEN}"
}
payload = {"url": video_url}
try:
    response = requests.post(YOUTUBE_TRANSCRIPT_API_URL, headers=headers, json=payload)
    response.raise_for_status()
    return response.json()
except requests.exceptions.RequestException as e:
    return {"error": str(e)}

Set up the Gemini Model with the Tool

model = genai.GenerativeModel( model_name='gemini-2.5-flash', tools=[get_youtube_transcription] )

Start a Chat Session and Send the Prompt

chat = model.start_chat(enable_automatic_function_calling=True) prompt = "Please provide the transcription of https://www.youtube.com/watch?v=DCv5p_eJTlU" response = chat.send_message(prompt)

print(response.text) Automation Platform Integration Zapier Integration YouTube2Text can be integrated with Zapier through MCP connections. Zapier's AI Actions feature supports MCP servers, allowing you to create automated workflows that trigger video transcriptions. Search for "Zapier MCP integration" or "Zapier AI Actions MCP" in the Zapier documentation to learn how to connect external MCP servers like YouTube2Text to your workflows.

n8n Integration n8n supports MCP integration through custom nodes and HTTP request nodes. You can connect YouTube2Text's MCP endpoint to n8n workflows for automated video processing pipelines. Search for "n8n MCP integration" or "n8n HTTP Request node MCP" in the n8n community documentation to find detailed setup instructions for connecting MCP servers to your automation workflows.

Additional Examples For more implementation examples, advanced usage patterns, and integration guides, visit the project repository for comprehensive documentation and code samples.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Playwright McpPlaywright MCP server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
ChatWiseThe second fastest AI chatbot™
Serper MCP ServerA Serper MCP Server
WindsurfThe new purpose-built IDE to harness magic
Tavily Mcp
CursorThe AI Code Editor
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
DeepChatYour AI Partner on Desktop
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Amap Maps高德地图官方 MCP Server
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.