YouTube Transcript API

YouTube Transcript API

By minhleathvn GitHub

A MCP server helps to transcript a youtube video

Overview

what is YouTube Transcript API Server?

YouTube Transcript API Server is a microservice that provides transcriptions of YouTube videos via a simple HTTP API.

how to use YouTube Transcript API Server?

To use the API, clone the repository, install the dependencies, and run the server. Make a GET request to the /transcript endpoint with a video_id parameter to retrieve the transcript.

key features of YouTube Transcript API Server?

  • Provides transcriptions for YouTube videos.
  • Simple HTTP API for easy integration.
  • Error handling for missing parameters and retrieval issues.

use cases of YouTube Transcript API Server?

  1. Automatically generating subtitles for YouTube videos.
  2. Analyzing video content for research purposes.
  3. Creating searchable text from video content.

FAQ from YouTube Transcript API Server?

  • Can I use this API for any YouTube video?

Yes! As long as you have the video ID, you can retrieve the transcript.

  • What happens if the video ID is missing?

The API will return an error message indicating the missing parameter.

  • Is there a limit to the number of requests I can make?

The API does not impose a strict limit, but be mindful of YouTube's API usage policies.

Content

YouTube Transcript API

A Python service that provides APIs to fetch and transcribe YouTube video content. It supports both REST API (Flask) and MCP server implementations.

Features

  • Fetch YouTube video transcripts in multiple languages (English and Vietnamese)
  • Auto-detect and use available transcripts
  • Fallback to audio transcription using Whisper when transcripts are unavailable
  • Support for both REST API and MCP server interfaces
  • Automatic language detection
  • Temporary file cleanup
  • Progress reporting for long-running operations

Installation

pip install -r requirements.txt

Usage

REST API (Flask)

Start the Flask server:

python apps/flask_server.py

Available endpoints:

  • GET /transcript?video_id=<video_id>&language=<lang> - Get video transcript
  • GET /video/info?video_id=<video_id> - Get video information
  • GET /health - Health check endpoint

MCP Server

Start the MCP server:

python apps/mcp_server.py

Available tools:

  • get_transcript(video_id, language) - Get video transcript
  • extract_transcript(video_id, language) - Extract transcript from audio
  • search_youtube_video(query) - Search for YouTube videos

Language Support

  • English (en)
  • Vietnamese (vi)
  • Auto-detection for other languages

Dependencies

  • youtube-transcript-api
  • pytube
  • whisper
  • torch
  • langdetect
  • flask (for REST API)
  • mcp (for MCP server)

Development

The project structure:

apps/
├── __init__.py
├── flask_server.py  # REST API implementation
├── mcp_server.py    # MCP server implementation
└── utils.py         # Shared utilities

License

MIT License

No tools information available.
No content found.