# Can ReClip Download Playlists? Yes, Here’s How the Backend Expands Them

> Discover how ReClip downloads videos from playlists. Learn how the backend expands playlists into individual URLs via the /api/playlist endpoint for seamless downloads.

- Repository: [Avery Gan/reclip](https://github.com/averygan/reclip)
- Tags: how-to-guide
- Published: 2026-09-05

---

**Yes, ReClip can download videos from playlists by expanding them into individual video URLs through the `/api/playlist` endpoint before processing each video separately.**

ReClip is a Flask-based web application that leverages `yt-dlp` to download videos from YouTube and other supported platforms. When users submit a playlist URL, the application does not treat it as a single entity; instead, it resolves the collection into discrete video URLs that feed into the standard download pipeline.

## How ReClip Handles Playlist Downloads

The playlist functionality operates through a coordinated handshake between the frontend interface and the backend API. Rather than modifying the core download logic, ReClip intercepts playlist URLs early and transforms them into arrays of individual video links.

### Backend: The `/api/playlist` Endpoint

In [`app.py`](https://github.com/averygan/reclip/blob/main/app.py), the Flask server defines a `/api/playlist` route (lines 43–63) that handles the expansion logic. When this endpoint receives a POST request containing a playlist URL, it executes `yt-dlp` with the `--flat-playlist` and `-J` flags to extract metadata without downloading. The subprocess call returns a JSON blob, which the code parses to pull the `url` field from each entry object in the `entries` array.

```python
@app.route("/api/playlist", methods=["POST"])
def get_playlist_info():
    data = request.json
    url = data.get("url", "").strip()
    if not url:
        return jsonify({"error": "No URL provided"}), 400

    cmd = ["yt-dlp", "--flat-playlist", "-J", url]
    result = subprocess.run(cmd, capture_output=True, text=True, timeout=60)
    info = json.loads(result.stdout)
    entries = info.get("entries", [])
    urls = [entry.get("url") for entry in entries if entry.get("url")]
    return jsonify({"urls": urls})

```

This approach returns a clean array of video URLs to the frontend, allowing the existing `/api/info` and `/api/download` routes to function unchanged for each item.

### Frontend: Playlist Detection Logic

The user interface in [`templates/index.html`](https://github.com/averygan/reclip/blob/main/templates/index.html) (lines 66–78) contains the detection mechanism that triggers the expansion. When the user clicks **Fetch**, the JavaScript iterates through submitted URLs and scans for the `list=` query parameter—a reliable indicator of a playlist URL on YouTube and similar platforms.

If the script detects this parameter, it sends the URL to `/api/playlist`, awaits the JSON response, and splices the returned array into the original URL list. This replacement operation effectively transforms one playlist entry into multiple individual video entries before the UI renders download cards.

```javascript
if (urls[i].includes('list=')) {
  const res = await fetch('/api/playlist', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ url: urls[i] })
  });
  const data = await res.json();
  if (data.urls) {
    urls.splice(i, 1, ...data.urls);
  }
}

```

## Download Workflow for Playlists

Once the frontend replaces the playlist URL with its constituent video URLs, ReClip treats each video as a separate download task. The interface generates a distinct card for every video in the playlist, displaying metadata and download options individually.

Users can initiate downloads for specific videos selectively, or they can click the **"Download All"** button to queue every video from the expanded playlist simultaneously. Because the expansion happens before the download phase, the `subprocess` calls to `yt-dlp` in the backend remain identical whether the source was a single video or a playlist entry.

## Summary

- **ReClip supports playlist downloads** by expanding them into individual video URLs via the `/api/playlist` endpoint.
- **Backend logic**: [`app.py`](https://github.com/averygan/reclip/blob/main/app.py) uses `yt-dlp --flat-playlist` to extract video URLs without downloading, returning them as a JSON array.
- **Frontend logic**: [`index.html`](https://github.com/averygan/reclip/blob/main/index.html) detects `list=` parameters, calls the playlist API, and splices the results into the URL queue.
- **UI behavior**: Each video becomes a separate card, enabling individual or bulk downloads through the existing download infrastructure.

## Frequently Asked Questions

### Does ReClip download the entire playlist as one file?

No. ReClip does not merge playlist videos into a single file. Instead, it extracts each video URL and processes them as separate downloads, resulting in individual video files for each entry in the playlist.

### What playlist formats does ReClip support?

ReClip supports any playlist format that `yt-dlp` recognizes with the `--flat-playlist` flag, including YouTube playlists and mixes. The detection logic specifically looks for URLs containing `list=` query parameters, which covers standard YouTube playlist URLs.

### Can I download individual videos from a playlist separately?

Yes. After ReClip expands a playlist in the frontend, each video appears as its own card in the interface. You can download specific videos individually or use the "Download All" button to fetch every video from the expanded list at once.

### Where is the playlist expansion logic located?

The expansion logic is split between two files: [`app.py`](https://github.com/averygan/reclip/blob/main/app.py) contains the `/api/playlist` route (lines 43–63) that handles the `yt-dlp` subprocess call, and [`templates/index.html`](https://github.com/averygan/reclip/blob/main/templates/index.html) contains the JavaScript detection and URL replacement logic (lines 66–78).