Skip to content

Instantly share code, notes, and snippets.

@notchum
Created January 4, 2023 22:27
Show Gist options
  • Save notchum/7bd0bb07e7f005f5135679f2bff58c71 to your computer and use it in GitHub Desktop.
Save notchum/7bd0bb07e7f005f5135679f2bff58c71 to your computer and use it in GitHub Desktop.
Use youtube-dlp to download Youtube videos by dragging a .URL file onto a batch script.
echo off
setlocal enableextensions enabledelayedexpansion
pushd %1
for %%F in (%1) do (
echo %%~dpnxF
call :findurl "%%~dpnxF"
)
popd
yt-dlp.exe -x --audio-format mp3 %url%
del %1
timeout 5
:findurl inputfile
set url=
for /f "tokens=3 delims==" %%i in ('findstr URL %1') do set url=%%i
echo %url%
echo -----
echo off
setlocal enableextensions enabledelayedexpansion
pushd %1
for %%F in (%1) do (
echo %%~dpnxF
call :findurl "%%~dpnxF"
)
popd
:: Change path below to file destination
CD /D E:\User Files\Videos\Youtube-dl
yt-dlp.exe -f "bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b" %url%
del %1
timeout 5
:findurl inputfile
set url=
for /f "tokens=3 delims==" %%i in ('findstr URL %1') do set url=%%i
echo %url%
echo -----
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment