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

> Unlock age-restricted and member-only YouTube videos with Agent-Reach. Learn how to configure YouTube cookies using the Agent-Reach CLI for seamless access to all content.

- Repository: [Pnant/Agent-Reach](https://github.com/Panniantong/Agent-Reach)
- Tags: how-to-guide
- Published: 2026-06-16

---

**Agent-Reach leverages yt-dlp to download YouTube content, and you can unlock access to age-restricted or channel-membership videos by configuring the `youtube-cookies` setting to point to your browser's cookie store using the CLI command `agent-reach configure youtube-cookies <browser>`.**

Agent-Reach is an open-source intelligence tool that processes YouTube videos through yt-dlp. When you need to access age-restricted or member-only content, you must configure YouTube cookies so the downloader can authenticate requests using your logged-in browser session.

## How Cookie Authentication Works in Agent-Reach

Agent-Reach delegates video downloading to **yt-dlp**, which supports reading cookies directly from browser SQLite databases. When you configure YouTube cookies for age-restricted videos, Agent-Reach stores the cookie source location in its global configuration and passes it to yt-dlp via the `--cookies-from-browser` flag.

The configuration flow involves these core components:

- **[`agent_reach/cli.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/cli.py)** (lines 1092–1096): Handles the `configure` sub-command and persists the `youtube_cookies_from` value
- **[`agent_reach/config.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/config.py)**: Manages the YAML configuration file at `~/.agent-reach/config.yaml`
- **[`agent_reach/channels/youtube.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/channels/youtube.py)**: Validates yt-dlp installation and triggers the download process
- **[`agent_reach/utils/paths.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/utils/paths.py)**: Contains `render_ytdlp_fix_command()` which constructs the yt-dlp command including the cookie flag

## Configuring YouTube Cookies via CLI

### Setting the Cookie Source

Run the configure command to specify which browser contains your YouTube login session:

```bash
agent-reach configure youtube-cookies chrome

```

Supported values include browser names (`chrome`, `firefox`, `edge`, `safari`) or absolute paths to browser profile directories:

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

```

### Verifying the Configuration

Confirm the setting was written to your configuration file:

```bash
agent-reach config show | grep youtube_cookies_from

```

Expected output:

```text
youtube_cookies_from: chrome

```

### Processing Restricted Videos

Once configured, Agent-Reach automatically includes cookies when processing URLs:

```bash

# Fetch an age-restricted video

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

# Extract transcripts from member-only content

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

```

## Implementation Details

When you execute `agent-reach configure youtube-cookies`, the CLI writes the value to the `youtube_cookies_from` key in `~/.agent-reach/config.yaml`. During video processing, the **YouTubeChannel** class in [`agent_reach/channels/youtube.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/channels/youtube.py) validates that yt-dlp is installed and that a JavaScript runtime is available.

The function `render_ytdlp_fix_command()` in [`agent_reach/utils/paths.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/utils/paths.py) constructs the final yt-dlp command, appending `--cookies-from-browser <value>` when the configuration key exists. This allows yt-dlp to authenticate with YouTube using your existing browser session, bypassing age-verification and membership checks.

## Summary

- Agent-Reach uses yt-dlp to download YouTube content, which requires authentication cookies for restricted videos
- Configure the cookie source using `agent-reach configure youtube-cookies <browser|path>`
- The setting is stored as `youtube_cookies_from` in `~/.agent-reach/config.yaml` via [`agent_reach/cli.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/cli.py)
- During execution, [`agent_reach/utils/paths.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/utils/paths.py) appends the `--cookies-from-browser` flag to yt-dlp commands
- This enables processing of age-restricted and member-only videos without manual cookie extraction

## Frequently Asked Questions

### Why do I need cookies for age-restricted videos?

YouTube requires authentication to verify age or membership status before serving restricted content. yt-dlp can read these authentication tokens from your browser's cookie store, allowing Agent-Reach to download videos that would otherwise return HTTP 403 or "content unavailable" errors.

### Can I use a custom cookie file instead of a browser profile?

Yes. While the examples show browser names like `chrome` or `firefox`, you can provide an absolute path to any directory containing the browser's SQLite cookie database. For example: `agent-reach configure youtube-cookies /path/to/custom/cookies.sqlite`.

### Where is the cookie configuration stored?

The configuration is persisted in the global Agent-Reach configuration file at `~/.agent-reach/config.yaml` under the key `youtube_cookies_from`. This file is managed by [`agent_reach/config.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/config.py) and written to by the CLI handler in [`agent_reach/cli.py`](https://github.com/Panniantong/Agent-Reach/blob/main/agent_reach/cli.py) at lines 1092–1096.

### What happens if yt-dlp cannot read my browser cookies?

If yt-dlp fails to access the specified browser profile—due to permissions, encryption, or the browser being locked—Agent-Reach will return an error indicating the video is unavailable. Ensure your browser is closed or use a copy of the cookie database to avoid file locking issues on Windows or macOS.