8000
Skip to content

Replaced spotipy with a non-api library#2626

Open
TzurSoffer wants to merge 10 commits intospotDL:masterfrom
TzurSoffer:master
Open

Replaced spotipy with a non-api library#2626
TzurSoffer wants to merge 10 commits intospotDL:masterfrom
TzurSoffer:master

Conversation

@TzurSoffer
Copy link
Copy Markdown
@TzurSoffer TzurSoffer commented Mar 15, 2026

Title

Due to recent changes in Spotify, the api is no longer useful to non-premium users, therfore I have replaced it.

Description

I have made a wrapper to spotAPI, which functions as a drag-n-drop replacement to spotipy, it not perfect, but it has fixed spotdl.
To install working verison run pip install git+https://github.com/TzurSoffer/spotify-downloader
If this helped you a star to my fork and bump would be appreciated to help promote this fix.

Related Issue

#2621
#2617

Motivation and Context

It solves the problem of the app not working without Spotify Premium.

How Has This Been Tested?

I have tested both playlists and individual songs.

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the CONTRIBUTING document
  • I have added tests to cover my changes
  • All new and existing tests passed

@TzurSoffer
Copy link
Copy Markdown
Author

I currently have a hardcoded variable in the Spotify.py file, but this should be a config option. I tried to make it a config option, but I am unfamiliar with this code and couldn't.

@TzurSoffer
Copy link
Copy Markdown
Author

Hey, is there any progress towards merging this PR?

@DylanBPY
Copy link
Copy Markdown

This branch works on my system

@DylanBPY
Copy link
Copy Markdown

@TzurSoffer Have you seen this?

@TzurSoffer
Copy link
Copy Markdown
Author

if you see that error, you didnt install my fork as it does not use api.spotify.com...
if you do spotdl --version does it print 4.4.5 or 4.4.3?

@gripfastistech
Copy link
Copy Markdown

if you see that error, you didnt install my fork as it does not use api.spotify.com... if you do spotdl --version does it print 4.4.5 or 4.4.3?

4.4.5

I had too many pre-existing versions hanging around, was pointing back to the previous .local install.

After removing everything spotdl related, reinstalled again from the fork, and its processing, without the error so far.

Thanks!

@sidelkins
Copy link
Copy Markdown

Works on my system! Thanks!

@m111k333
Copy link
Copy Markdown

works very well,thank you!

@ciangottinim
Copy link
Copy Markdown
ciangottinim commented Mar 26, 2026

I tried it with the "artist" option and it doesn't work, I don't know if I'm doing something wrong or not; I run the command on a linux headless server, I attached the command and the error here:

Command: spotdl download artist:X --headless --output {artist}/{album}/{title}.{output-ext} --format m4a
Error: error.txt

@TzurSoffer
Copy link
Copy Markdown
Author

Artists are not yet supported, download a playlist with all his songs instead for now

@taco-mustard
Copy link
Copy Markdown
taco-mustard commented Mar 27, 2026

Thanks, it works pretty well! Just running into a couple errors at the moment (running this on mac):

  1. Trying to download spotify playlist from youtube playlist of same length via spotdl "{youtube playlist url}|{spotify playlist url}" results in AttributeError: 'Downloader' object has no attribute 'download_url'
  2. Downloading spotify playlists of over about 30 songs (after using command ulimit -n 10000) results in AudioProviderError: YT-DLP download error

@TzurSoffer
Copy link
Copy Markdown
Author

@taco-mustard Please provide the commands as well as the output from the terminal so I can fix replicate it

@taco-mustard
Copy link
Copy Markdown
taco-mustard commented Mar 27, 2026

This was the code that led to the AttributeError
spotdl "https://www.youtube.com/playlist?list=PL7fDRdzfbWcwVwup1gMdeO46S7-lMwFG2|https://open.spotify.com/playlist/2G42OAnMtsPSeUDmsC9TBt?si=UIpV6CXnRA-yrDnkf0bfhA"

This was the output

Found 121 songs in dl_songs (Playlist)                                                                                                                                                                                 
AttributeError: 'Downloader' object has no attribute 'download_url' ```

@TzurSoffer
Copy link
Copy Markdown
Author
TzurSoffer commented Mar 27, 2026

@taco-mustard It possible that youtube is bugged, I dont have time to fix it rn. for now, you can do
spotdl "https://open.spotify.com/playlist/2G42OAnMtsPSeUDmsC9TBt"
if you have trouble with yt-dlp, update it pip install -U yt-dlp

@taco-mustard
Copy link
Copy Markdown

changing candidate_urls = [self.download_url] to candidate_urls = [song.download_url] in line 716 of spotdl/download/downloader.py appears to fix the issue for me

@yonka2019
Copy link
Copy Markdown

oh got it.
The version works perfectly, you're god
Thanks!

@JonneSaloranta
Copy link
Copy Markdown

Seems to work well with spotify playlist links.
First had an issue with songs not downloading but I updated yt-dlp package as suggested and now it works.

@taco-mustard It possible that youtube is bugged, I dont have time to fix it rn. for now, you can do spotdl "https://open.spotify.com/playlist/2G42OAnMtsPSeUDmsC9TBt" if you have trouble with yt-dlp, update it pip install -U yt-dlp

@mborn1
Copy link
Copy Markdown
mborn1 commented Apr 2, 2026

It did not work using pip install for me, however, cloning the forked repo and building with uv did work for me (also after upgrading yt-dlp version).
Starred the fork, hope it gets merged soon.

My configuration

Command (with uv environment active)

  • python -m spotdl [playlist url]

Spotify environment

  • Created dev app (today)
  • Set both http://127.0.0.1:9900 and http://127.0.0.1:9900/ as the redirect URIs
  • Added my premium account to the permitted users
  • Altered ~/.config/spotdl/config.json to include my client_id, clent_secret, and port = 9900

System specs

  • Ubuntu 24.04 LTS - kernel 6.17.0-19-generic
  • Python 3.12.3
  • uv 0.11.1 (a6042f67f 2026-03-24 x86_64-unknown-linux-gnu)

@elktonsgay2025
Copy link
Copy Markdown

When attempting to install your version I am now getting this;
ERROR: Error [Errno 2] No such file or directory: 'git' while executing command git version
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?

@TzurSoffer
Copy link
Copy Markdown
Author

Either install git or download the repo as zip, unzip it, and run pip install . in the folder

@elktonsgay2025
Copy link
Copy Markdown

My apologies for so many comments, still learning this. When I install your thread and run python -m spotdl I get this right afterwards, no downloads;

Traceback (most recent call last):
File "", line 189, in _run_module_as_main
File "", line 148, in _get_module_details
File "", line 112, in _get_module_details
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/spotdl/init.py", line 13, in
from spotdl.console import console_entry_point
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/spotdl/console/init.py", line 5, in
from spotdl.console.entry_point import console_entry_point
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/spotdl/console/entry_point.py", line 12, in
from spotdl.console.download import download
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/spotdl/console/download.py", line 7, in
from spotdl.download.downloader import Downloader
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/spotdl/download/downloader.py", line 20, in
from spotdl.download.progress_handler import ProgressHandler
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/spotdl/download/progress_handler.py", line 23, in
from spotdl.types.song import Song
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/spotdl/types/song.py", line 11, in
from spotdl.utils.spotify import SpotifyClient
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/spotdl/utils/spotify.py", line 217, in
from SpotipyFree import Spotify as SpotifyClient # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/SpotipyFree/init.py", line 3, in
from .Spotify import Spotify
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/SpotipyFree/Spotify.py", line 3, in
import spotapi
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/spotapi/init.py", line 1, in
from spotapi.artist import *
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/spotapi/artist.py", line 4, in
from spotapi.types.annotations import enforce
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/spotapi/types/init.py", line 1, in
from spotapi.types.data import *
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/spotapi/types/data.py", line 4, in
from spotapi.http.request import TLSClient
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/spotapi/http/init.py", line 1, in
from spotapi.http.request import *
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/spotapi/http/request.py", line 4, in
from tls_client.settings import ClientIdentifiers
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/tls_client/init.py", line 15, in
from .sessions import Session
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/tls_client/sessions.py", line 1, in
from .cffi import request, freeMemory, destroySession
File "/data/data/com.termux/files/usr/lib/python3.13/site-packages/tls_client/cffi.py", line 20, in
library = ctypes.cdll.LoadLibrary(f'{root_dir}/dependencies/tls-client{file_ext}')
File "/data/data/com.termux/files/usr/lib/python3.13/ctypes/init.py", line 480, in LoadLibrary
return self._dlltype(name)
~~~~~~~~~~~~~^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.13/ctypes/init.py", line 361, in init
self._handle = self._load_library(name, mode, handle, winmode)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.13/ctypes/init.py", line 401, in _load_library
return _dlopen(name, mode)
OSError: dlopen failed: library "libpthread.so.0" not found: needed by /data/data/com.termux/files/usr/lib/python3.13/site-packages/tls_client/dependencies/tls-client-arm64.so in namespace (default)

@TzurSoffer
Copy link
Copy Markdown
Author

You probably need to install libpthread.so.0

@elktonsgay2025
Copy link
Copy Markdown

Is this not doable on android with termux since the phone isn't rooted?

@TzurSoffer
Copy link
Copy Markdown
Author

Idk, never tested it

@elktonsgay2025
Copy link
Copy Markdown

It seems like this is only working on computers and will not work on termux for android. If anyone has any fixes for that I'm all ears please

@watrd
Copy link
Copy Markdown
watrd commented Apr 3, 2026

Is there anyway to get the lyrics attached into the mp3 file like the way original spotdl does it?
btw good work, it's working fine for me

@TzurSoffer
Copy link
Copy Markdown
Author
TzurSoffer commented Apr 3, 2026

Is there anyway to get the lyrics attached into the mp3 file like the way original spotdl does it? btw good work, it's working fine for me

I am not aware of my app changing anything about the lyrics.
Do you get any errors? What command are you using

@jacksos101
Copy link
Copy Markdown

Installing your version results in spotdl working - THANK YOU! How can I buy you a coffee??

@TzurSoffer
Copy link
Copy Markdown
Author

Glad I could help, no need to give me anything, although I would appreciate it if you could star the repo

@lukuelogel
Copy link
Copy Markdown
lukuelogel commented Apr 5, 2026

thx now its working . But it didnt download all my songs , i have like 93 track but only 49 downloanded is there some fix ?

@lukuelogel
Copy link
Copy Markdown

Hi its me again i want to know if there is a fix. i have like 93 track but only 49 downloanded is there some fix ?

@TzurSoffer
Copy link
Copy Markdown
Author

Command and output please

@lukuelogel
Copy link
Copy Markdown

Command and output please

what do you mean ?
it started to dowloand from yt

@TzurSoffer
Copy link
Copy Markdown
Author

what command did you write and what was the result on screen, also attach the result from running spotdl --version

@lukuelogel
Copy link
Copy Markdown

what command did you write and what was the result on screen, also attach the result from running spotdl --version

this command set SPOTIPY_CLIENT_ID= && set SPOTIPY_CLIENT_SECRET= && spotdl https://open.spotify.com/playlist/2zWAhfJu7JNBgRE0V2iudY?si=b3ae5847d54f4a89
and the verzion is 4.4.6

@TzurSoffer
Copy link
Copy Markdown
Author

do pip install -U yt-dlp, that should fix your issues

@lukuelogel
Copy link
Copy Markdown

do pip install -U yt-dlp, that should fix your issues

ok i will try it

@lukuelogel
Copy link
Copy Markdown

do pip install -U yt-dlp, that should fix your issues

ok i will try it

and i have one more question do i need another program to see all metadata when uploading to like my phone ?

@TzurSoffer
Copy link
Copy Markdown
Author

If you mean to play the song while seeing the cover/lyrics, I use Musicolet. If you mean for uploading the songs, it doesn't matter how you do it, but I like to use Syncthing to automatically upload the changes when they are made

@lukuelogel
Copy link
Copy Markdown

If you mean to play the song while seeing the cover/lyrics, I use Musicolet. If you mean for uploading the songs, it doesn't matter how you do it, but I like to use Syncthing to automatically upload the changes when they are made

i use offline music bc that app is not available on appstore. and i ment like cover and the autor/s of the song

@lukuelogel
Copy link
Copy Markdown

If you mean to play the song while seeing the cover/lyrics, I use Musicolet. If you mean for uploading the songs, it doesn't matter how you do it, but I like to use Syncthing to automatically upload the changes when they are made

oh it does work with metadata now i know i dont need another program yust to add cover etc thx man for help. but it still tripping on some songs

@TzurSoffer
Copy link
Copy Markdown
Author

That part is due to yt-dlp, just update it every once in a while, and it should hopefully sort itself out (pip install -U yt-dlp)

@lukuelogel
Copy link
Copy Markdown
BD9E lukuelogel commented Apr 5, 2026

Title

Due to recent changes in Spotify, the api is no longer useful to non-premium users, therfore I have replaced it.

Description

I have made a wrapper to spotAPI, which functions as a drag-n-drop replacement to spotipy, it not perfect, but it has fixed spotdl. To install working verison run pip install git+https://github.com/TzurSoffer/spotify-downloader If this helped you a star to my fork and bump would be appreciated to help promote this fix.

Related Issue

thx man

@TzurSoffer
Copy link
Copy Markdown
Author

ofc, if you found it useful, please leave a star on the repo
https://github.com/TzurSoffer/spotify-downloader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0