Skip to main content
Glama

get_video_info

Extract video metadata from YouTube or TikTok URLs to access title, description, chapters, duration, channel, upload date, view count, and tags without playing the video.

Instructions

Fetch full metadata for a YouTube or TikTok video without playing it: title, description, chapters, duration, channel, upload date, view count, tags.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesYouTube or TikTok video URL

Implementation Reference

  • The tool 'get_video_info' is registered here and defines its logic, which invokes fetchVideoInfo.
    server.tool(
      'get_video_info',
      'Fetch full metadata for a YouTube or TikTok video without playing it: title, description, chapters, duration, channel, upload date, view count, tags.',
      { url: z.string().url().describe('YouTube or TikTok video URL') },
      async ({ url }) => {
        const urlErr = validateVideoUrl(url);
        if (urlErr) return errorResult(urlErr);
        const depErr = checkDeps();
        if (depErr) return errorResult(depErr);
    
        try {
          const info = await fetchVideoInfo(url);
          const chapters = (info.chapters as Array<Record<string, unknown>> | undefined)?.map((ch) => ({
            title: ch.title, start: ch.start_time, end: ch.end_time,
          })) || [];
    
          return textResult({
            title: info.title, channel: info.channel, upload_date: info.upload_date,
            duration: info.duration, view_count: info.view_count, like_count: info.like_count,
            description: info.description, tags: info.tags, chapters,
          });
        } catch (err) {
          return errorResult(`Error: ${err instanceof Error ? err.message : String(err)}`);
        }
      }
    );
  • The function 'fetchVideoInfo' performs the actual execution of yt-dlp to fetch video metadata.
    export function fetchVideoInfo(url: string): Promise<YtEntry> {
      return spawnYtDlp([
        url, '-J', '--no-playlist',
        '--cookies-from-browser', getBrowser(),
      ]).then((out) => JSON.parse(out));
    }

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/ronantakizawa/social-video-mcp'

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