# How to Use the Player Option for Streaming Playback in You-Get

> Learn how to use the player option in you-get to stream media directly to external players like mpv or vlc, bypassing local file storage for instant playback.

- Repository: [Mort Yao/you-get](https://github.com/soimort/you-get)
- Tags: how-to-guide
- Published: 2026-03-06

---

**The `--player` (or `-p`) option in you-get pipes extracted media URLs directly to external players like mpv or vlc, bypassing local file storage for instant streaming playback.**

The `you-get` tool from the soimort/you-get repository is a command-line utility for downloading media from various websites. While it excels at saving videos locally, its **player option for streaming playback** offers a lightweight alternative for users who want to watch content immediately without consuming disk space.

## What Is the Player Option for Streaming Playback?

The `--player` flag allows you to specify an external media player command that will receive the stream URL instead of downloading the file to your local filesystem. When you provide this option, `you-get` extracts the direct media URL from the hosting site and immediately hands it off to your chosen player via a subprocess call. This enables **on-the-fly playback** without waiting for a complete download, making it ideal for previewing content or operating on systems with limited storage.

## How the Player Option Works Internally

The streaming functionality is implemented across three core components in the codebase: argument parsing, extractor logic, and player execution.

### CLI Argument Registration

The command-line interface defines the flag in [`src/you_get/common.py`](https://github.com/soimort/you-get/blob/main/src/you_get/common.py) around line 1600. The argument is added to the download argument group with both short (`-p`) and long (`--player`) forms:

```python

# src/you_get/common.py

download_grp.add_argument(
    '-p', '--player', metavar='PLAYER',
    help='Stream extracted URL to a PLAYER'
)

```

### Extractor Logic and Stream Routing

Once a URL is resolved, the extractor logic in [`src/you_get/extractor.py`](https://github.com/soimort/you-get/blob/main/src/you_get/extractor.py) checks whether a player was supplied. Around line 205, a conditional statement determines the execution path: if `player` is not `None`, the stream URLs are passed directly to the player function, bypassing the file download pipeline entirely.

### External Player Execution via launch_player()

The actual player invocation happens in [`src/you_get/common.py`](https://github.com/soimort/you-get/blob/main/src/you_get/common.py) through the `launch_player()` function (defined around line 273). This function handles command parsing, executable validation, and subprocess execution:

```python

# src/you_get/common.py

def launch_player(player, urls):
    import subprocess, shlex, shutil, sys
    # Prepare the command and verify player exists

    if sys.version_info >= (3, 3):
        exefile = shlex.split(player)[0]
        if shutil.which(exefile):
            subprocess.call(shlex.split(player) + urls)
        else:
            log.wtf('[Failed] Cannot find player "%s"' % exefile)
    else:
        subprocess.call(shlex.split(player) + urls)

```

When `--player` is present, `you-get` calls `launch_player(player, stream_urls)` instead of invoking the download pipeline, enabling immediate playback.

## Practical Usage Examples

### Stream to MPV

To watch a YouTube video immediately in mpv without downloading:

```bash
you-get -p "mpv --fs" https://www.youtube.com/watch?v=dQw4w9WgXcQ

```

The extracted URL is handed to mpv, which starts playing full-screen immediately.

### VLC with Custom Arguments

For VLC with specific options to hide the title display:

```bash
you-get -p "vlc --no-video-title-show" "https://vimeo.com/12345678"

```

VLC receives the direct stream URL and begins playback with your specified configuration.

### Code Implementation Details

The integration between the extractor and player is seamless. When you invoke `you-get` with `-p`, the [`extractor.py`](https://github.com/soimort/you-get/blob/main/extractor.py) module detects the player parameter and routes the `stream_urls` list to `launch_player()` rather than calling the file writer. This architectural decision keeps the streaming logic separate from the download logic, allowing both pathways to share the same URL extraction code while diverging only at the final output stage.

## Summary

- The `--player` (or `-p`) option enables **direct streaming** to external media players without local file storage.
- Argument parsing occurs in [`src/you_get/common.py`](https://github.com/soimort/you-get/blob/main/src/you_get/common.py), while the execution decision happens in [`src/you_get/extractor.py`](https://github.com/soimort/you-get/blob/main/src/you_get/extractor.py) around line 205.
- The `launch_player()` function in [`src/you_get/common.py`](https://github.com/soimort/you-get/blob/main/src/you_get/common.py) handles subprocess invocation and executable validation.
- This feature supports any player that accepts a URL as an argument, including **mpv**, **vlc**, and **mplayer**.

## Frequently Asked Questions

### Does the player option download the file to disk?

No. When you use the `--player` option, `you-get` extracts the direct media URL and passes it immediately to your specified player via a subprocess call. The download pipeline is bypassed entirely, meaning no data is written to your local filesystem unless the player itself caches the stream.

### Which media players work with the player option?

Any command-line media player that accepts a URL as an argument is compatible. Common choices include **mpv**, **vlc**, **mplayer**, and **ffplay**. The `launch_player()` function in [`src/you_get/common.py`](https://github.com/soimort/you-get/blob/main/src/you_get/common.py) validates that the executable exists in your system PATH before attempting to invoke it.

### How do I pass custom arguments to my media player?

Enclose the player command and its arguments in quotes when using the `-p` or `--player` flag. For example: `you-get -p "mpv --fs --no-terminal" <URL>`. The `launch_player()` function uses `shlex.split()` to parse the command string correctly, ensuring arguments are passed to the player as intended.

### Where is the player option defined in the source code?

The command-line flag is defined in [`src/you_get/common.py`](https://github.com/soimort/you-get/blob/main/src/you_get/common.py) around line 1600, where it is added to the download argument group as `-p`/`--player`. The logic that checks for this option and routes streams accordingly is located in [`src/you_get/extractor.py`](https://github.com/soimort/you-get/blob/main/src/you_get/extractor.py) around line 205, while the actual player execution happens in the `launch_player()` function within [`src/you_get/common.py`](https://github.com/soimort/you-get/blob/main/src/you_get/common.py) around line 273.