Skip to content

Add custom parameter support to /ytdlp command#185

Merged
krau merged 5 commits intomainfrom
copilot/optimize-ytdlp-command
Jan 19, 2026
Merged

Add custom parameter support to /ytdlp command#185
krau merged 5 commits intomainfrom
copilot/optimize-ytdlp-command

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 19, 2026

The /ytdlp command only accepted URLs with hardcoded parameters (format sorting, mp4 recoding, filename restrictions), preventing users from customizing downloads via yt-dlp flags.

Changes

Command parsing

  • Parse flags (prefixed with -/--) separately from URLs
  • Detect URLs by :// presence to avoid consuming them as flag values
  • Pass both flags and URLs to task execution

Task execution

  • Accept custom flags array in ytdlp.Task
  • Pass flags to yt-dlp before URLs: [FLAGS...] [URLS...]
  • Apply default behavior (format sorting, recoding) only when no flags provided
  • Always preserve output path for temp directory safety

Data flow

  • Added YtdlpFlags []string to tcbdata.Add and ytdlp.Task
  • Updated handler chain: handleYtdlpCmdCreateAndAddYtdlpTaskWithEditNewTask

i18n

  • Updated usage messages with flag examples (EN/CN)

Usage

# Backward compatible
/ytdlp https://example.com/video

# With custom flags
/ytdlp --format best https://example.com/video
/ytdlp --extract-audio --audio-format mp3 https://example.com/video

# Multiple URLs
/ytdlp --format best https://example.com/v1 https://example.com/v2

Flags and URLs can be mixed in any order. The parser correctly differentiates between flag values and URLs.

Original prompt

Optimize the /ytdlp command to be the same as using yt-dlp in the terminal. Implement support for passing parameters to yt-dlp


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Optimize /ytdlp command for yt-dlp parameters Add custom parameter support to /ytdlp command Jan 19, 2026
Copilot AI requested a review from krau January 19, 2026 04:35
@krau krau marked this pull request as ready for review January 19, 2026 05:09
@krau krau merged commit 3e20dc2 into main Jan 19, 2026
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.

2 participants