S5T is a terminal-based program written in Python, utilising the yt-dlp and ytmusicapi python libraries, as well as FFMPEG.
S5T allows you to quickly and efficiently fetch any Youtube Music search query (song or album) or URL (also song or album / playlist), in lightweight 320K MP3 format.
S5T downloads your music in the form of MP3's, which will also contain the appropriate metadata (album, artist, etc), ensuring your files are compatible with music players and other software!
S5T is available accross all operating systems (as long as Python + dependencies are installed; see requirements.txt).
I do not encourage piracy, this software is intended for the user's own uploaded content or sampling royalty free audio. Use responsibly! ;)
DISCLAIMER: FFMPEG is required to convert the downloaded media to the appropriate MP3 format. Please ensure this program is present and installed on the system.
Alternatively, if you are running Windows, having ffmpeg.exe present in the program's folder will also work.
This will be mentioned briefly later on :)
If you are currently in a terminal / command prompt, type the following command:
git clone https://github.com/OofySimpsonV3/S5T
If ^this command returns an error, or if you don't have GIT installed, no worries! Simply follow these instructions:
- Click the green
<> Codebutton at the top of this repository's webpage. - Simply hit the
Download ZIPbutton, to clone the repository as a compressed ZIP file. - Extract the freshly downloaded ZIP file by using your desired ZIP extracting software.
- Navigate into the un-compressed folder.
Now that we have cloned the repository, we must ensure we have Python and the dependencies installed for S5T.
To install Python, simply click here to navigate to the official Python downloads page. Please ensure you select the correct option for your operating system, and for the best results, please ensure you are downloading the latest version of Python.
Please also ensure pip is installed when installing Python. This is the tool to download Python dependencies.
Once Python is installed on your system, we can now ensure the appropriate dependencies / libraries are installed, to ensure the software functions correctly.
To install the dependencies, simply type the following command:
pip install -U -r requirements.txt OR python -m pip install -U -r ./requirements.txt
Please note: if the python command doesn't exist after installation, please also try py, python3, or py3.
This will download all the dependencies listen within the requirements.txt file.
Alternatively, you may also install the dependencies using the following command:
pip install -U yt-dlp ytmusicapi
Now that we have downloaded the files for the software, it would also be a good time, for Windows users, to *place the ffmpeg.exe binary in the repository folder, with the main.py, etc.
Now we have the repository cloned, the interpreter (Python) installed as well as the dependencies, we may now test our software!
Ensuring your terminal session is still within the repository folder, we may run the main python file:
python main.py
This will return the command usage. You should see something like this:
[user@archlinux ~/S5T]$ python main.py
Arguments:
--url <URL> (may require quotes)
Downloads Youtube media via a URL
--song "<QUERY>"
Searches and downloads the first song result in Youtube Music.
--album "<QUERY>"
Searches and downloads the first album result in Youtube Music.
--video "<QUERY>"
Searches and downloads the first video result in Youtube Music.
--help
Shows a list of commands.
Simply append the relevant arguments to your command. For example:
python main.py --song "Ghost Town The Specials"
The software uses an API which ensures the search feature is nice and flexible. This means the software (should) know which song you are wishing to download, dispite grammar or spelling.
For example, python main.py --song "Gohst Town by Specials" would download the same song as the previous example.
The software is now officially downloaded and operational! However, going to the repository folder and typing python main.py... every time for a song or album can drastically affect the efficiency of the tool.
To ensure future use is nice and simple, we can assign the program to our own, custom command / alias!
To create an alias in most Linux / *NIX systems, you would simply use the alias command.
Typing alias getsong='python ~/Downloads/s5t/main.py' will create an alias for the entire command and path, with the convenience of being just a single command, being getsong in this example.
Creating an alias is only temporary, however, and closing the terminal session will clear the alias from the memory.
To ensure the alias is available every time we enter our terminal session, we simply have to append the alias command to the end of the .bashrc file, located within the home (~) directory.
To do this is one easy command, simply enter:
echo "alias getsong='python /home/user/Downloads/s5t/main.py'" >> ~/.bashrc
This will ensure the alias is assigned each time a terminal session is opened.
Please note: The shell RC file may differ between shell environments. E.g. The FreeBSD operating system natively uses the .shrc RC file, as this OS uses standard sh instead of bash.
If you wish to remove your alias, simply edit the RC file using your preferred text editor and simply remove the line which assigns the alias.
WARNING: This process will require the Registry Editor and, therefore, will require Admin access.
To set up a permenant alias in the Windows command prompt, it is just a tad more tricky. Luckily, just like UNIX, these one-time steps will ensure a future ease of access, and can also be removed any time.
In Windows, the DOSKEY command is used to create custom aliases, in this case named macro's!
To begin, we will need to create a Batch file which will store any custom aliases (hereby referred to as macros).
Please note, any other macros can be made at any time using this batch file. If you'd like to make or experiment with future macros, please ensure the file path is remembered or stored somewhere safe!
Anywhere in your Windows home folder, create a file named macros.bat, ensuring the filepath is remembered, as it would be required quite shortly.
After creating our file, simply add the following command to the file:
DOSKEY getsong=python C:/absolute/path/to/S5T/main.py $*
After creating the file which declares our custom macro(s), we now need to ensure this code runs whenever a Command Prompt is opened.
To do this, we would require the Registry Editor.
Then, open the following register:
HKEY_CURRENT_USER\Software\Microsoft\Command Processor
Add a String Value named Autorun, and set the value to the path (absolute) of the macros.bat file.
You are now finished! Simply reboot your machine, open the Command Prompt and type in your custom macro!
For example: getsong --album "ELO - Eldorado"
Should you experience any issues with this software, such as bugs, errors, inconveniences or deprecated code, please reach out via Github or my E-Mail address mail@antonwilliams.me so I may help out as much as possible!
Feel free to contribute to this project with any issues or pull requests.
Go wild! :)
(THIS DOESN'T INCLUDE THE DEPENDENCIES - Refer to Credits heading below).
HUGE thanks to the developers of The YT-DLP Project, The YTMusicAPI and The FFMPEG Project. If it wansn't for their hard work and software, this project simply wouldn't be as good as it is now.
Enjoy!