mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 08:35:49 +03:00
[GH-ISSUE #1106] How to delete playlists using spotipy #659
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#659
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @JackDyre on GitHub (May 14, 2024).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1106
Which method should I use to delete a playlist that I own? I didn't see any methods in the documentation that directly delete a playlist (though I could have just missed it) and ChatGPT told me to use current_user_unfollow_playlist, but I get an error whenever I use it:
Am I using the wrong method or am I using the method incorrectly?
@JackDyre commented on GitHub (May 15, 2024):
I figured out that you must input a playlist ID rather than a URL
From the docs:
Should this method only accept an IDs and not URLS?
@dieser-niko commented on GitHub (May 15, 2024):
Yep, I know about this already. This part of the docs is somewhat misleading because normally spotipy converts URLs automatically (with
Spotify._get_id), but this conversion doesn't happen everywhere. @stephanebruckert is there a reason for that?@dieser-niko commented on GitHub (May 17, 2024):
Oh, sorry, I just realised I didn't read your question properly. Deleting playlists is not directly possible.
This may sound silly (because it is imo), but Spotify believes that if you decide to delete your playlist, but there are some followers who like it, then the playlist won't actually be deleted, it will just be removed from your library.
You can try this yourself by creating a playlist, copying the link, deleting the playlist and then trying to access the playlist via the link. You will then have your playlist back.
I don't really know if the playlists will deleted at some point. If you go to the recover playlists, Spotify states that they will remove the playlist from the list after 90 days, but I can't confirm nor deny if this would delete the playlist for good.
So to answer your question: ChatGPT gave you the right answer. But for some reason, there's no URI validation, so just make sure that you're using
1Rqvqd7cI4AoeDn5Ei3mqlinstead of the whole link as an argument.@JackDyre commented on GitHub (Jun 27, 2024):
Would the fix just be as simple as adding
self._get_id("playlist", playlist_id)inside the f string in thecurrent_user_unfollow_playlist()method?For example:
Additionally, shouldn't the
nameparam in the docstring be changed toplaylist_id?@stephanebruckert commented on GitHub (Jun 27, 2024):
That should do it @JackDyre, would you be up to open a PR for it?
@JackDyre commented on GitHub (Jun 27, 2024):
Sure!
@JackDyre commented on GitHub (Jun 28, 2024):
Is there a reason why
_get_id()and similar methods are private? I don't understand why they are even methods ofSpotifyin the first place. Being able to convert between IDs and URIs seems like it would be useful to have in a project.