From 8f36280f739a743e4e1f4feed8831fc562943f9a Mon Sep 17 00:00:00 2001 From: yash37158 Date: Mon, 4 Oct 2021 22:15:11 +0530 Subject: [PATCH] Adding Youtube_MP3_Audio_Download python file --- .../Youtube mp3 download/README.md | 10 +++++++++ .../youtube_mp3_download.py | 21 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 Amazing Python Projects_Scripts/Youtube mp3 download/README.md create mode 100644 Amazing Python Projects_Scripts/Youtube mp3 download/youtube_mp3_download.py 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