Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Downloads Online Videos using youtube-dl command line tool
- # Downloads videos in the best way for the best quality (video and audio)
- # Works for youtube.com and many other online video sites (see https://rg3.github.io/youtube-dl/supportedsites.html)
- # Script Version: 1.0A
- # Tool Source: https://rg3.github.io/youtube-dl/
- # Reference: http://howto.blbosti.com/2010/03/download-youtube-videos-with-youtube-dl/
- # Documenation: https://github.com/rg3/youtube-dl/blob/master/README.md#readme
- # Supported Sites: https://rg3.github.io/youtube-dl/supportedsites.html
- $argsCustom = ''
- # Edit from here:
- $destinationFolder = 'D:\Downloads'
- $cliToolLocation = 'C:\Users\Dean\Google Drive\Batch Scripts\Commands\youtube-dl.exe'
- $destinationFileName = '%(title)s.%(ext)s'
- # Download List must be a text file with one download address per line
- $downloadListFile = 'C:\Users\Dean\Google Drive\Batch Scripts\PowerShell\YouTube Download Script\downloadlist.txt'
- # Custom Settings ($true OR $false)
- $consoleShowProgressInTitle = $true # Should download progress be shown in the title of the window?
- $writeASubtitleFile = $true # Should a subtitle download be attempted (if site supports it)
- # Playlist Settings ($true OR $false)
- $downloadAsPlaylist = $true # Download in playlist mode?
- $playlistReverse = $true # Download a playlist in reverse order?
- $playlistRandomize = $false # Download a playlist in randomized order?
- # Whether or not to update the YouTube-DL tool (set to false when running a download)
- $updateYoutubeDLTool = $false
- # End edits here! ========================
- if($downloadAsPlaylist -eq $true)
- {
- $argsCustom = '--yes-playlist '
- if($playlistReverse -eq $true)
- {
- $argsCustom += '--playlist-reverse '
- }
- elseif($playlistRandomize -eq $true)
- {
- $argsCustom += '--playlist-random '
- }
- }
- else
- {
- $argsCustom += '--no-playlist '
- }
- if($consoleShowProgressInTitle -eq $true)
- {
- $argsCustom += '--console-title '
- }
- if($writeASubtitleFile -eq $true)
- {
- $argsCustom += '--write-sub '
- }
- # Update Tool
- if($updateYoutubeDLTool -eq $true)
- {
- Start-Process $cliToolLocation -ArgumentList '-U'
- exit
- }
- # Start Download
- Write-Host 'Downloading Video(s)' -ForegroundColor Yellow
- # For each url in the downloadlist.txt file try to download it
- foreach ($url in get-content $downloadListFile)
- {
- $args = $argsCustom+'-f ''bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best\'' -o "' + $destinationFolder + '/' + $destinationFileName + '" '+$url
- # Write-Host $args
- # Wait for each process to end
- $process = Start-Process $cliToolLocation -ArgumentList $args -PassThru
- $process.WaitForExit()
- # Set-Clipboard $args
- }
- Write-Host 'Video(s) Downloaded to:'$destinationFolder -ForegroundColor Green
Add Comment
Please, Sign In to add comment