Skip to main content
Glama

get_youtube_feed

Fetch videos from your YouTube account's subscriptions, liked videos, watch later list, or viewing history using authenticated browser cookies.

Instructions

Fetch videos from your YouTube account using Chrome cookies. Supports: subscriptions, liked, watch_later, history.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
feedYesWhich feed to fetch
limitNoMax number of videos to return (default 15)

Implementation Reference

  • The tool registration and handler logic for 'get_youtube_feed'. It validates input parameters, calls 'fetchFeed', and processes the result using 'pickVideoFields'.
    server.tool(
      'get_youtube_feed',
      'Fetch videos from your YouTube account using Chrome cookies. Supports: subscriptions, liked, watch_later, history.',
      {
        feed: z.enum(['subscriptions', 'liked', 'watch_later', 'history']).describe('Which feed to fetch'),
        limit: z.number().min(1).max(50).default(15).describe('Max number of videos to return (default 15)'),
      },
      async ({ feed, limit }) => {
        const depErr = checkDeps();
        if (depErr) return errorResult(depErr);
    
        try {
          const result = await fetchFeed(FEED_URLS[feed], limit);
          const videos = (result.entries || []).map(pickVideoFields);
          return textResult({ feed, count: videos.length, videos });
        } catch (err) {
          return errorResult(`Error fetching ${feed}: ${err instanceof Error ? err.message : String(err)}`);
        }
      }
    );
  • The core logic that fetches the YouTube feed data by spawning 'yt-dlp' with appropriate arguments.
    export function fetchFeed(url: string, limit: number, start = 1): Promise<YtFeedResult> {
      const args = [
        url, '-J', '--flat-playlist',
        '--playlist-start', String(start),
        '--playlist-end', String(start + limit - 1),
        '--cookies-from-browser', getBrowser(),
      ];
    
      // YouTube-specific extractor arg
      if (url.includes('youtube.com') || url.includes('youtu.be')) {
        args.push('--extractor-args', 'youtubetab:approximate_date');
      }
    
      return spawnYtDlp(args).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