Skip to main content
Glama

MCP Video Digest

by R-lz
youtube.py1.38 kB
import os from typing import Optional import yt_dlp from ..transcription.base import Context class YouTubeDownloader: """YouTube video downloader""" def __init__(self): self.ydl_opts = { "format": "bestaudio", "outtmpl": "temp_audio.%(ext)s", "quiet": True, "cookiefile": "cookies.txt", "http_headers": { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36", } } async def download(self, url: str, ctx: Context) -> Optional[str]: """ Download the audio part of the video Args: url: video URL ctx: context object Returns: Optional[str]: the path of the downloaded file, or None if failed """ ctx.log("Start downloading video...") try: with yt_dlp.YoutubeDL(self.ydl_opts) as ydl: info = ydl.extract_info(url, download=True) downloaded_file = ydl.prepare_filename(info) ctx.log(f"Download completed, file path: {downloaded_file}") return downloaded_file except Exception as e: ctx.log(f"Download failed: {str(e)}") return None

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/R-lz/mcp-video-digest'

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