问题
This is a continuation on my previous question:
How to create a youtube downloader gui with youtube-dl in batch
I have found out how the downloading of the video works, which means I could somehow enter the command line using Notepad. Here is my current code:
cls
@echo off
title youtube downloader
:downloader
echo youtuber downloader!!!
pause
cls
set "site="
set /p "site=Please enter youtube link here> "
If Not Defined site cls & goto downloader
echo Do you want to download "%site%" as mp3?
pause
set /p choice=
if %choice%== yes goto mp3
if %choice%== no goto mp4
s
:mp4
@echo off
cls
C:\Users\Andly\Documents\youtube-dl.exe %site%
echo ok
end
:mp3
@echo off
cls
C:\Users\Andly\Documents\youtube-dl.exe %site% --audio-format mp3
echo ok
end
end
I need help with the audio format in MP3, and I know I'm able to access command line with the app. However, when I choose to download as MP3, it just crashes.
Does anyone know why this happens?
Also my youtube-dl
file is in C:\Users\Username\Document\youtube-dl-
(I use C:\Users\Username\Document\youtube-dl.exe
), but it still works when I tried it in mp4, and yes I have tried C:\Users\Username\Document\youtube-dl\youtube-dl
.
来源:https://stackoverflow.com/questions/59432184/how-to-download-mp3-using-youtube-dl-with-a-batch-file