How to Configure YouTube Cookies for Age-Restricted or Member-Only Videos in Agent-Reach

To configure YouTube cookies for age-restricted or member-only videos in Agent-Reach, use the agent-reach configure youtube-cookies command to point yt-dlp at your browser's cookie store, enabling authentication that bypasses restriction checks.

Agent-Reach leverages yt-dlp to process YouTube content, but age-restricted and membership-only videos require authenticated sessions. By configuring YouTube cookies, you enable the tool to read restricted content using your existing browser authentication stored in ~/.agent-reach/config.yaml.

Agent-Reach does not handle authentication directly. Instead, it stores a reference to your browser's cookie location in the global configuration file under the key youtube_cookies_from. When processing a video URL, the YouTubeChannel class passes this value to yt-dlp, which reads the actual cookies from your browser's SQLite database using the --cookies-from-browser flag.

This approach allows yt-dlp to authenticate requests exactly as a logged-in browser would, bypassing age-verification and membership checks without requiring manual cookie extraction.

Step-by-Step Configuration

The configure sub-command in agent_reach/cli.py (lines 1092-1096) handles parsing and storage of the cookie source. Run the following command to point Agent-Reach at your browser profile:

agent-reach configure youtube-cookies chrome

For non-standard installations or custom profiles, provide the absolute path to the browser's user data directory:

agent-reach configure youtube-cookies /home/user/.config/google-chrome/Default

Verifying Your Configuration

Confirm that the setting was written correctly to the configuration file:

agent-reach config show | grep youtube_cookies_from

You should see output indicating the stored value:

youtube_cookies_from: chrome

Processing Restricted Videos

Once configured, process age-restricted or member-only videos using the standard read command:


# Fetch video content with automatic transcription

agent-reach read https://www.youtube.com/watch?v=RESTRICTED_ID

# Extract subtitles only

agent-reach read --transcribe https://youtu.be/RESTRICTED_ID

Technical Implementation Details

CLI Configuration Handler

In agent_reach/cli.py, the configuration logic writes the provided value to the global config using config.set("youtube_cookies_from", value). This occurs at lines 1092-1096 when handling the configure sub-command for youtube-cookies.

Channel Integration

The YouTubeChannel class in agent_reach/channels/youtube.py checks for yt-dlp installation and JavaScript runtime availability before processing. When a valid configuration exists, it informs the backend to include cookie authentication in subsequent yt-dlp invocations.

Command Construction

The function render_ytdlp_fix_command() in agent_reach/utils/paths.py constructs the final yt-dlp command. When youtube_cookies_from is present in the configuration, it appends the --cookies-from-browser flag with the stored value, ensuring yt-dlp authenticates using your browser's session data.

Summary

  • Use the CLI command agent-reach configure youtube-cookies <browser> to set your cookie source in ~/.agent-reach/config.yaml.
  • Supported browsers include Chrome, Edge, Firefox, and others compatible with yt-dlp's --cookies-from-browser flag.
  • The configuration key youtube_cookies_from is written by agent_reach/cli.py and read by agent_reach/channels/youtube.py during video processing.
  • Age-restricted and member-only videos become accessible once yt-dlp authenticates using your browser's cookie store via the command constructed in agent_reach/utils/paths.py.

Frequently Asked Questions

Agent-Reach supports any browser compatible with yt-dlp's --cookies-from-browser flag, including Chrome, Chromium, Edge, Firefox, Safari, and Brave. You can specify either the browser name for default profiles or the absolute path to a specific profile directory.

While Agent-Reach specifically implements the --cookies-from-browser approach through the youtube_cookies_from configuration key, yt-dlp also supports --cookies flags for Netscape-formatted cookie files. To use a custom file, you would need to modify the command construction in agent_reach/utils/paths.py where render_ytdlp_fix_command() builds the yt-dlp invocation.

Why does Agent-Reach need cookies for age-restricted videos?

YouTube requires authentication to verify age or membership status before serving restricted content. Agent-Reach uses yt-dlp as the download backend, which must present valid session cookies to YouTube's servers. Without these cookies, yt-dlp receives HTTP 403 errors or "content unavailable" messages for restricted videos.

The cookie source is stored in the global configuration file at ~/.agent-reach/config.yaml under the key youtube_cookies_from. This value is written by the CLI handler in agent_reach/cli.py (lines 1092-1096) and read by the channel implementation in agent_reach/channels/youtube.py during video processing.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →