Comments (7)
I figured out that you must input a playlist ID rather than a URL
From the docs:
Spotipy supports a number of different ID types:
Spotify URI - The resource identifier that you can enter, for example, in the Spotify Desktop client’s search box to locate an artist, album, or track. Example: spotify:track:6rqhFgbbKwnb9MLmUQDhG6
Spotify URL - An HTML link that opens a track, album, app, playlist or other Spotify resource in a Spotify client. Example: http://open.spotify.com/track/6rqhFgbbKwnb9MLmUQDhG6
Spotify ID - A base-62 number that you can find at the end of the Spotify URI (see above) for an artist, track, album, etc. Example: 6rqhFgbbKwnb9MLmUQDhG6
In general, any Spotipy method that needs an artist, album, track or playlist ID will accept ids in any of the above form
Should this method only accept an IDs and not URLS?
from spotipy.
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?
from spotipy.
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 1Rqvqd7cI4AoeDn5Ei3mql
instead of the whole link as an argument.
from spotipy.
Would the fix just be as simple as adding self._get_id("playlist", playlist_id)
inside the f string in the current_user_unfollow_playlist()
method?
For example:
def current_user_unfollow_playlist(self, playlist_id):
""" Unfollows (deletes) a playlist for the current authenticated
user
Parameters:
- name - the name of the playlist
"""
return self._delete(
f"playlists/{self._get_id("playlist", playlist_id)}/followers"
Additionally, shouldn't the name
param in the docstring be changed to playlist_id
?
from spotipy.
That should do it @JackDyre, would you be up to open a PR for it?
from spotipy.
Sure!
from spotipy.
Is there a reason why _get_id()
and similar methods are private? I don't understand why they are even methods of Spotify
in the first place. Being able to convert between IDs and URIs seems like it would be useful to have in a project.
from spotipy.
Related Issues (20)
- Improve 'util.py' with function docstrings HOT 4
- the playlist function stopped working between yesterday and today HOT 5
- API Reference Refers to Deprecated Methods HOT 2
- Update Directions In TUTORIAL.md
- Documentation for version 2.23.0 not available HOT 8
- Current 2.23.0 install from pip doesn't include latest code HOT 4
- Update Directions and Content of CONTRIBUTING.md HOT 1
- Backend terminal shows: " Enter the URL you were redirected to: " HOT 5
- Adding a custom date range for users top tracks and top artist HOT 1
- Account Creation Timestamp field HOT 2
- Any way to play a playlist? Without premium if possible. HOT 1
- Podcast transcript HOT 1
- How spotipy have to be setted for deploying? HOT 1
- How do I start playback on the command line/headless? HOT 6
- Invalidate cache if the credentials change (or the credentials become invalid) HOT 3
- An error occurred: can only concatenate tuple (not "str") to tuple when using Spotipy functions HOT 7
- Move linting/code style checks to a separate test HOT 2
- Playlist longer than 100 items fails to iterate with sample code HOT 4
- Fails to query audio features for LOCAL track files that aren't available HOT 6
- Running .artist() & .album_tracks() methods are stuck running & won't execute HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spotipy.