Wrote a convenient batch script for a friend not comfortable with using YouTube-DL via the command-line interface. Thought it may come in handy for others too. This is convenient even for me because I forget the parameters from time to time too lol.
This script is also available on GitHub Gist.
@echo off
echo Checking for update...
if exist youtube-dl.exe ( goto :computeSum ) else (
echo It seems like you don't have youtube-dl on your computer.
goto :download
)
:computeSum
setlocal enableextensions enabledelayedexpansion
set /a counter = 0
for /f "delims=" %%i in ('CertUtil -hashfile .\youtube-dl.exe MD5') DO (
set /a counter+=1
if !counter!==2 (
set hash1=%%i
)
)
endlocal && set hash1=%hash1%
echo Downloading checksum file...
echo.
powershell -Command "Invoke-WebRequest https://github.com/ytdl-org/youtube-dl/releases/latest/download/MD5SUMS -OutFile tmp.txt"
echo Finished!
echo.
setlocal enableextensions enabledelayedexpansion
set /a counter = 0
for /f "delims= " %%i in (tmp.txt) DO (
set /a counter+=1
if !counter!==2 (
set hash2=%%i
)
)
endlocal && set hash2=%hash2%
del tmp.txt
if %hash1%==%hash2% ( goto :youtubeDL ) else ( goto :download )
:download
echo Automatically downloading/upgrading youtube-dl.exe...
echo.
powershell -Command "Invoke-WebRequest https://github.com/ytdl-org/youtube-dl/releases/latest/download/youtube-dl.exe -OutFile youtube-dl.exe"
echo Finished!
echo.
:youtubeDL
set /p DIRECTORY=Where do you want to store your file (Enter a directory here, a directory should look something like C:\Users\Rick\xxx):
echo.
:while
set /p URL=What is the link to the video:
echo.
youtube-dl.exe -o "%DIRECTORY%\\%%(title)s.%%(ext)s" "%URL%"
echo Download Complete!
set /p INPUT=Would you like to download more videos? (y/n):
if "%INPUT%"=="y" (
echo.
goto :while
)