
youtube parser context7
Testing context7
Repository Info
About This Server
Testing context7
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
YouTube Transcript API
MCP-compatible server for retrieving YouTube video transcripts.
Installation
# Clone repository
git clone <repository-url>
cd youtube-transcript-api
# Install dependencies
npm install
# Create .env file
cp .env.example .env
Running
# Development mode
npm run dev
# Production mode
npm start
By default, the server runs on port 3000. You can change the port by setting the PORT environment variable in the .env file.
API Endpoints
Get Video Transcript
URL: /api/youtube/transcript
Method: POST
Content-Type: application/json
Request Body:
{
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
or
{
"videoId": "dQw4w9WgXcQ"
}
Optional Parameters:
lang: Language code for transcript (e.g., "en", "ru", "fr")generateIfNotFound: Boolean indicating whether to generate captions if not found (default: true)
Successful Response:
{
"success": true,
"data": {
"videoId": "dQw4w9WgXcQ",
"transcript": [
{
"text": "Never gonna give you up",
"start": 15.5,
"duration": 2.3
},
{
"text": "Never gonna let you down",
"start": 17.8,
"duration": 2.1
}
// ...
],
"generated": false
}
}
Errors:
- 400 Bad Request: Invalid URL or video ID
- 404 Not Found: Video not found or no captions available (and generation disabled)
- 500 Internal Server Error: Server error or caption generation error
Caption Generation
If captions are not found on YouTube, the server can automatically generate them using speech recognition. For this:
- Audio is extracted from the video using ytdl-core
- Audio is converted to WAV format using ffmpeg
- Speech is recognized using Whisper API
To disable automatic caption generation, set the generateIfNotFound parameter to false:
{
"videoId": "dQw4w9WgXcQ",
"generateIfNotFound": false
}
Usage Examples
cURL
curl -X POST http://localhost:3000/api/youtube/transcript \
-H "Content-Type: application/json" \
-d '{"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"}'
JavaScript (Fetch API)
fetch('http://localhost:3000/api/youtube/transcript', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
videoId: 'dQw4w9WgXcQ',
lang: 'en', // optional
generateIfNotFound: true // optional
}),
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
License
ISC
Quick Start
Clone the repository
git clone https://github.com/sergey-kvachenok/youtube-parser-context7Install dependencies
cd youtube-parser-context7
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.