Skip to content

Instantly share code, notes, and snippets.

@mmdriley
Created March 14, 2021 04:02
Show Gist options
  • Save mmdriley/370b1ee5419172d388912076913bd203 to your computer and use it in GitHub Desktop.
Save mmdriley/370b1ee5419172d388912076913bd203 to your computer and use it in GitHub Desktop.
youtube-dl a folder of URL shortcuts
$wscript = New-Object -ComObject WScript.Shell
# Push script parent folder
$MyInvocation.MyCommand.Path | Split-Path -Parent | Push-Location
# Create directories for videos and already-downloaded links
"Videos", "DownloadedLinks" |
% { New-Item $_ -ItemType Directory -ErrorAction SilentlyContinue }
# Download videos
Push-Location Videos
Get-ChildItem "..\*.url" |
% { $wscript.CreateShortcut($_).TargetPath } |
% { youtube-dl $_ }
Pop-Location
# Archive links
Move-Item "*.url" DownloadedLinks/
Pop-Location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment