diff --git a/Amazing Python Projects_Scripts/Youtube mp3 download/README.md b/Amazing Python Projects_Scripts/Youtube mp3 download/README.md new file mode 100644 index 000000000..218d33768 --- /dev/null +++ b/Amazing Python Projects_Scripts/Youtube mp3 download/README.md @@ -0,0 +1,10 @@ +# Youtube MP3 Audio Download +The ```Youtube_mp3_download.py``` is to convert youtube video format to mp3 format + +# Requirement +Any system with python 3 (preferably 3.6 or higher) and terminal. + +# Usage +- Navigate to the file directory where the downloaded file (the script file) is stored. +- Run the file, using `python youtube_mp3_download.py ` and run. +- Wait for sometime, and Whola!! your youtube audio is downloaded. \ No newline at end of file diff --git a/Amazing Python Projects_Scripts/Youtube mp3 download/youtube_mp3_download.py b/Amazing Python Projects_Scripts/Youtube mp3 download/youtube_mp3_download.py new file mode 100644 index 000000000..e569b5e45 --- /dev/null +++ b/Amazing Python Projects_Scripts/Youtube mp3 download/youtube_mp3_download.py @@ -0,0 +1,21 @@ +#This program is to convert youtube video format to mp3 format +import youtube_dl +import sys + + +#to choose the best audio format available , the 'preffereddcode' will be mp3 and rest will be as it is +ydl_opts = { + 'format': 'bestaudio/best' , + 'postprocessors': [{ + 'key': 'FFmpegExtractAudio', + 'preferredcodec': 'mp3', + 'preferredquality': '192', + }], +} + +if __name__ == '__main__': + with youtube_dl.YoutubeDL(ydl_opts) as ydl: + filenames = sys.argv[1:] + ydl.download(filenames) + +#For output type python youtube mp3 download followed by \ No newline at end of file