How to download MP3 using youtube-dl with a batch file?

你。 提交于 2020-01-06 04:37:33

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!