问题
Is there any documentation for the Spotify Web API as to which characters are valid when searching? For example "Macklemore & Ryan Lewis" needs the & to be url encoded in order for the request to work.
The character ":" is completely invalid it seems. In order to search for an album like "Pink Friday: Roman Reloaded", I have to remove the : completely from the String. Even URL encoding it doesn't work. This probably was to do with the fact that : seems to be used to separate the fields of the query.
Other characters like .[()/ seem to work ok. Any docs on this anywhere? Just want to know we are being comprehensive. Thanks.
回答1:
Given the Björk example here,
http://ws.spotify.com/search/1/artist?q=artist:Bj%C3%B6rk
You'll need percent encoding. Not sure what technology you're using, if javascript, this answer should help - URL encode sees “&” (ampersand) as “&” HTML entity.
Update:
Colons are special characters used for advanced search. Queries involving colons need to be quoted, unless it's an advanced search :).
来源:https://stackoverflow.com/questions/20622068/spotify-web-api-special-characters