Songs downloader for Spotify and Youtube.
Find a file
Elyazid Essoly cf9e36785c
Merge pull request #4 from bluewolf44/main
Changed to allow non utf-8 terminal to work
2025-11-15 08:56:53 +01:00
.github update readme 2025-08-13 00:30:30 +01:00
.gitignore init commit 2025-07-13 15:42:06 +01:00
functions.py fix 403 forbidden error, closes #2 2025-09-27 14:22:21 +02:00
LICENSE update README.md, add LICENSE 2025-07-13 16:48:48 +01:00
menu.py Changed to allow non utf-8 terminal to work 2025-11-15 18:07:43 +13:00
README.md modify readme 2025-10-30 04:35:08 +01:00
requirements.txt v 2.0.0 2025-08-12 00:56:02 +01:00

SpotFetch :

SpotFetch Demo

A simple python program to download Music from various platfroms using yt-dlp ( The audio source is YouTube or YouTube Music ).

What it can do :

  • Download Spotify playlists after exporting the playlist as a csv file from Exportify
  • batch download music from a .txt file with URLs one by line, or using a custom CSV file with headers name,artist
  • Direct download from a Youtube url, can be a video or playlist.
  • Search then download a song using its name and artist name.
  • Audio is downloaded as MP3, M4A, or FLAC.
  • Song cover or thumbnail are always embedded, alongside numerous metadata.
  • You can use a cookie file in case YouTube rate limits your session.
  • Download using either YouTube music or Youtube.
  • You can download from platforms other than Spotify if you convert your playlists as CSVs using services like tunemymusic.com .

Installation :

Requirements :

  • First make sure you have ffmpeg installed on your machine Download here.
  • Make sure you have Python installed too, and is in your system path.
  • If you dont have Git to clone the repo thats fine, you can download it as a zip file and uncompress it, see here.

setup :

  • Clone this repository ( or just download it as a zip file and uncompress it ):
git clone https://github.com/MrElyazid/SpotFetch.git
  • then :
cd SpotFetch
  • Install requirements.txt ( preferably use a new virtual environement ):
pip install -r requirements.txt
  • Thats it, now run menu.py :
python3 menu.py
# or python menu.py
# or py menu.py

note :

It is recommended to use a virtual environement since installing requirements globally on your machine is generally bad, before running pip install -r requirements.txt make sure you create and then activate a venv, and if on Windows and running powershell you might need to run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser before activating the venv.

Some details :

I get track_name error or errors when parsing the csv :

Make sure the language set in Exportify is English.

How does the program set the best quality and bitrate ?

First off, YouTube uses adaptive streaming, the best available quality for a video can change depending on variables like the server load, location ... etc, to get the best available quality at the time of the request, the argument bestaudio for yt-dlp ensures exactly that, and then comes the transcoding, when converting from the bestaudio format ( which is often opus or vorbis in WebM containers ) to mp3 or m4a the argument prefferedqyality: '0' is used, this ensures we dont produce a bloated transcode and perform VBR encoding instead of just setting the maximum bitrate which will just result in a large file size for the audio, note that for flac this last argument is ignored since the format is lossless.

in short : the best quality possible is always chosen.

Use the following extensions to get cookies for YouTube depending on your browser : Chrome, Firefox.

You can read more about using cookies with yt-dlp here

Download Platform Selection

  • YouTube Music (default): Works best for popular songs and if you don't want to download video clip audio.
  • YouTube: Works best for niche and lesser-known songs and artists.

How should the urls txt file look like ?

simply put each link in a line with no quotes, example :

https://youtu.be/dQw4w9WgXcQ?si=zQ_s7NhWcPgEQ46b
https://youtu.be/6-8E4Nirh9s?si=e7LKPptaE6vEEI48
https://music.youtube.com/watch?v=k-3y2LVF_SE&si=G2Dtl4LUbzjGIcpy

How should the custom CSV file look like ?

the headers are name,artist an example :

name,artist
"in the end","linkin park"
"under pressure","queen"
"time","pink floyd"

I keep getting 403 Forbidden Error :

If you get ERROR: unable to download video data: HTTP Error 403: Forbidden when trying to download, this is probably because yt-dlp needs to be updated, you can run pip install -r requirements.txt --upgrade to update it.

Also if using a venv, make sure you activate it before each launch of the app.

Using SpotFetch on Android :

since SpotFetch is just a python program, you can run it on any machine with python installed, you can run it on Android via Termux ( you can also find Termux on Google play ), after installation follow these commands :

  • Upgrade your system packages :
pkg update && pkg upgrade

Make sure to type Enter whenever needed while upgrading.

  • Install python, git, ffmpeg:
pkg install git python ffmpeg
  • Clone this repo :
git clone https://github.com/MrElyazid/SpotFetch
  • cd into the directory :
cd SpotFetch/
  • install the requirements:
pip install -r requirements.txt
  • Rotate your phone : do it so that the terminal UI doesnt look awful :/

  • Run menu.py :

python menu.py

Thats it, after downloading try to locate where Termux stores files on your Android and access your downloaded files there.

Contributing :

If you have any enhancement ideas for the program or encountered a bug, you can submit an issue or a PR or start a discussion, happy to help!