Skip to content

Instantly share code, notes, and snippets.

@margnus1
Created August 20, 2013 11:33
Show Gist options
  • Select an option

  • Save margnus1/6280292 to your computer and use it in GitHub Desktop.

Select an option

Save margnus1/6280292 to your computer and use it in GitHub Desktop.
PowerShell script to download the contents of a YouTube channel using youtube-dl.
Function YT-ChanRip($channel) {
$wc = New-Object System.Net.WebClient
for ($index = 1;; $index = $index + 50) {
$url = "http://gdata.youtube.com/feeds/api/users/$channel/uploads?start-index=$index&max-results=50"
$page = $wc.DownloadString($url)
$matches = [System.Text.RegularExpressions.Regex]::Matches($page, "watch\?v=[^ `"`'\\]{11}")
if ($matches.Count -eq 0) { return }
$uniquematches = $matches | Sort-Object | Get-Unique -AsString
foreach ($match in $uniquematches) {
iex "youtube-dl.exe --title --no-overwrites http://youtube.com/$match"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment