Skip to content

feat: add youtube playlist support#28

Open
AmanoSpica wants to merge 2 commits intoaverygan:mainfrom
AmanoSpica:feat/youtube-playlist
Open

feat: add youtube playlist support#28
AmanoSpica wants to merge 2 commits intoaverygan:mainfrom
AmanoSpica:feat/youtube-playlist

Conversation

@AmanoSpica
Copy link
Copy Markdown

Summary

This pull request adds support for handling YouTube playlist URLs by expanding them into individual video URLs before processing. (fixes #9)

Changes

Backend

  • Added a new /api/playlist POST endpoint in app.py
  • Executes the command yt-dlp --flat-playlist -J <url> to retrieve playlist entries (without format data)
  • Returns the extracted video URLs from playlist entries as a JSON array

Frontend

  • Updated templates/index.html to detect YouTube playlist URLs
  • Calls the /api/playlist endpoint when a playlist URL is detected
  • Replaces the playlist URL with a list of individual video URLs for further processing

Result

  • Users can input YouTube playlist URLs directly
  • Playlists are automatically expanded into individual video URLs
  • Enables seamless processing without manual extraction

Difference from #27

This PR improves the following points compared to #27:

  • /api/info processing time was too long

    • Due to yt-dlp behavior, fetching an entire playlist at once is slow
    • This PR expands the playlist beforehand, making it behave the same as multiple individual URLs
  • Users could not see progress clearly

    • Since processing now behaves like multiple URLs, each video's result is shown as soon as it is ready
    • This improves user experience (UX)

@Ranjesh2002
Copy link
Copy Markdown

Hey, I tested this locally and noticed it only fetches the first video from a playlist URL rather than all videos. I have a working implementation in #27 that fetches the full playlist by removing --no-playlist from both get_info() and run_download() and parsing the multiple JSON lines yt-dlp returns. Feel free to check it out!

@AmanoSpica
Copy link
Copy Markdown
Author

@Ranjesh2002
Ah, good catch — I was only handling pure playlist URLs (e.g. https://www.youtube.com/playlist?list=xxxx) and missed the case where a video URL includes a playlist (e.g. watch?v=xxxx&list=xxxx).

I've updated the implementation to also detect and expand those cases.

Could you try it again when you have a moment?

@AmanoSpica
Copy link
Copy Markdown
Author

One advantage of expanding the playlist upfront (as in my approach) is that it may make future enhancements easier.

For example:

  • The total number of videos is known in advance, which could help when implementing a progress bar
  • Each video is handled independently, so it would be easier to support cancellation without needing to terminate a running yt-dlp process

Just wanted to share this as a possible benefit from a future extensibility/UX perspective.

DeBondor added a commit to DeBondor/reclip that referenced this pull request Apr 11, 2026
…an#14 — cookies, playlist, AAC, GIF, batch download

- averygan#25: cookies.txt support (COOKIES_FILE auto-detected, passed to all yt-dlp calls)
- averygan#28: YouTube playlist expansion via /api/playlist endpoint (flat-playlist -J)
- averygan#29: Force AAC audio codec (-S acodec:aac) for all video/audio downloads
- averygan#20: GIF export via ffmpeg 2-pass palettegen/paletteuse, 15fps, max 480px width
- averygan#14: Batch download via /api/batch/download + /api/batch/status, ThreadPoolExecutor(3), parallel Download All
@Ranjesh2002
Copy link
Copy Markdown

Just tested with the watch?v=xxx&list=xxx format too, my implementation in #27 handles it correctly and expands all 13 videos without any additional URL detection logic. Since --no-playlist is removed entirely, yt-dlp naturally expands any URL containing a playlist parameter. No special casing needed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can you add downloading of playlists from YouTube?

2 participants