Celerium.YTdlp
Celerium.YTdlp

GitHub_Test GitHub_Pages

PoshGallery_Version PoshGallery_Platforms PoshGallery_Downloads codeSize

Contributors Forks Stargazers Issues

GitHub_License


Logo

PowerShell Gallery · Report Bug · Request Feature


Thanks

Big thanks to the yt-dlp maintainers & contributors for the incredible open source audio/video downloader this module wraps.

About The Project

The Celerium.YTdlp PowerShell wrapper offers a convenient & consistent way of using yt-dlp from PowerShell. It can install & update yt-dlp, download videos or audio using the highest quality settings, & read video metadata as PowerShell objects.

  • :book: Celerium.YTdlp project documentation can be found on Github Pages
  • :book: yt-dlp’s documentation can be found here

Highlights:

  • yt-dlp is installed with winget (yt-dlp.yt-dlp) which also installs the FFmpeg & Deno dependencies
  • Compare the installed yt-dlp version to the latest stable release & update it
  • Highest quality video & audio downloads with a single command
  • Every parameter is PascalCase & the most common yt-dlp options are exposed, anything else can be passed with -AdditionalArguments
  • Supports Windows PowerShell 5.1 & PowerShell 7+ on Windows, Linux, & macOS
Save-YTdlpVideo -Url 'https://www.youtube.com/watch?v=cE0wfjsybIQ'
Save-YTdlpAudio -Url 'https://www.youtube.com/watch?v=cE0wfjsybIQ'

(back to top)

Install

This module can be installed directly from the PowerShell Gallery with the following command:

Install-Module -Name Celerium.YTdlp
  • :information_source: This module supports Windows PowerShell 5.1 & PowerShell 7+ on Windows, Linux, & macOS.
  • :information_source: If you are running an older version of PowerShell, or if PowerShellGet is unavailable, you can manually download the main branch and place the latest version of Celerium.YTdlp from the build folder into the (default) C:\Program Files\WindowsPowerShell\Modules folder.

Celerium.YTdlp project documentation can be found on Github Pages

  • A full list of functions can be retrieved by running Get-Command -Module Celerium.YTdlp.
  • Help info and a list of parameters can be found by running Get-Help <command name>, such as:
Get-Help Save-YTdlpVideo
Get-Help Save-YTdlpVideo -Full

(back to top)

Initial Setup

yt-dlp must be installed. On Windows the module installs it with winget:

Import-Module Celerium.YTdlp

Install-YTdlp           # winget install yt-dlp.yt-dlp (also installs FFmpeg & Deno)
Get-YTdlpVersion        # Installed version vs the latest stable version
Update-YTdlp            # Updates yt-dlp only when a newer stable version exists
  • :information_source: FFmpeg is required to merge video & audio streams, convert audio, & embed metadata. The winget package installs it for you.
  • :information_source: winget is only available on Windows. On Linux & macOS install yt-dlp with your package manager (for example brew install yt-dlp) or the standalone binary, Update-YTdlp will then use yt-dlp --update-to stable.
  • :information_source: The module finds yt-dlp using the PATH & the default winget locations, a custom location can be used with the -ExecutablePath parameter.

(back to top)

Usage

  • The following is a table of functions:
  • Example scripts can be found in the examples folder of this repository.
Category Function Description Example
Install Install-YTdlp Installs yt-dlp using winget N/A
Install Get-YTdlpVersion Compares the local yt-dlp version to the latest stable version N/A
Install Update-YTdlp Updates yt-dlp to the latest stable version N/A
Download Save-YTdlpVideo Downloads a video using the highest quality settings Invoke-VideoDownload
Download Save-YTdlpAudio Downloads a video as an audio file using the highest quality settings Invoke-AudioDownload
Download Invoke-YTdlp Core wrapper exposing the common yt-dlp options as parameters N/A
Information Get-YTdlpVideoInfo Gets video metadata without downloading N/A

All functions, including the private helper functions, are exposed by the module.

Download a video with the highest settings

Save-YTdlpVideo -Url 'https://www.youtube.com/watch?v=cE0wfjsybIQ' -OutputPath 'C:\Videos'

Uses bestvideo*+bestaudio/best, sorts by resolution, frame rate, HDR, & codec, merges to mkv, & embeds the metadata, chapters, & thumbnail.

Download a video & convert it to a mp3 with the highest settings

Save-YTdlpAudio -Url 'https://www.youtube.com/watch?v=cE0wfjsybIQ' -OutputPath 'C:\Music'

Use any yt-dlp option

# yt-dlp $Url -x --audio-format mp3 -N 12 -w -v --embed-metadata -o "%(title)s.%(ext)s"
Invoke-YTdlp -Url $Url -ExtractAudio -AudioFormat mp3 -ConcurrentFragments 12 -NoOverwrites -EmbedMetadata -OutputTemplate '%(title)s.%(ext)s' -Verbose

# Options without a parameter
Invoke-YTdlp -Url $Url -AdditionalArguments '--sponsorblock-remove', 'sponsor'
  • :information_source: In yt-dlp -n is the --netrc option, the number of concurrent fragments is -N.
  • :information_source: Add -WhatIf to any download function to see the yt-dlp command line without running it, -Verbose adds the yt-dlp --verbose option, & -InformationAction SilentlyContinue hides the yt-dlp progress.

Read video metadata

(Get-YTdlpVideoInfo -Url 'https://www.youtube.com/watch?v=cE0wfjsybIQ').formats | Select-Object format_id, resolution, vcodec, acodec

(back to top)


Contributing

Contributions are what makes the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag “enhancement”. Don’t forget to give the project a star! Thanks again!

See the CONTRIBUTING guide for more information about contributing.

(back to top)

License

Distributed under the MIT license. See LICENSE for more information.

GitHub_License

(back to top)


Table of contents