Last active
November 11, 2024 11:43
-
-
Save wincmd64/4a5463f0ba9926d38e7484b611240ccd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: Downloads video from link in clipboard using yt-dlp (+ ffmpeg) | |
:: winget install yt-dlp.yt-dlp Gyan.FFmpeg | |
@echo off | |
:: finds the downloads folder | |
for /f "delims=" %%a in ('powershell -command "(New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path"') do set "DOWNLOADS=%%a" | |
:: get value from clipboard | |
for /f "delims=" %%i in ('powershell Get-Clipboard') do set "url=%%i" | |
:check | |
yt-dlp.exe -F -S vext "%url%" | |
if ERRORLEVEL 1 ( | |
:: if the url is not read from the buffer - enter manually | |
set /p url=Enter the url: | |
echo. | |
goto check | |
) | |
echo. | |
set num= | |
set /p num=Enter videoID+audioID (for example 137+140) or leave empty for the best video with the best extension: | |
echo. | |
if not defined num ( | |
:: For video, mp4 > mov > webm > flv. For audio, m4a > aac > mp3 ... | |
yt-dlp.exe -S "ext" "%url%" -P "%DOWNLOADS%" -o "%%(title).50s.%%(ext)s" --no-part | |
if ERRORLEVEL 1 (goto check) | |
) else ( | |
:: Can be combined with any other params like --download-sections "*00:xx:xx-00:xx:xx" | |
yt-dlp.exe -f %num% "%url%" -P "%DOWNLOADS%" -o "%%(title).50s.%%(ext)s" --no-part | |
if ERRORLEVEL 1 (goto check) | |
) | |
color 27 | |
explorer "%DOWNLOADS%" | |
timeout 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
подправил