A subset of the YouTube Downloader script. This Python script allows you to download audio from YouTube videos and convert them to MP3 format in 320 kbps.
Features:
- Validates YouTube video URLs.
- Extracts video title and removes non-alphabetical characters.
- Checks for video availability.
- Downloads the audio stream in MP4 format.
- Converts the MP4 audio to MP3 format.
- Cleans up by removing the downloaded MP4 file.
Usage:
- Ensure you have the following libraries installed:
requests
,pytube
,os
,pydub
,re
,urllib.parse
. You can install them usingpip install requests pytube os pydub re urllib.parse
. - Make sure you have FFmpeg installed on your system (https://github.com/BtbN/FFmpeg-Builds/releases) and the ffmpeg.exe, ffplay.exe, ffprobe.exe files in your project folder.
- Save the code as
youtube_mp3.py
. - Run the script:
python youtube_mp3.py
. - Paste the YouTube video URL when prompted.
- The script will download the audio, convert it to MP3, and save it in the same directory as the script.
Note:
- This script is for educational purposes only and should not be used for downloading copyrighted material without permission.
- This is a work in progress and may have bugs or limitations.
Updates:
- Direct MP4 to MP3 conversion has been achieved.
- Both www.youtube.com or youtu.be are accepted.