我正在尝试使用Spotify objective-c库来搜索属于艺术家专辑的特定歌曲。我不想使用searchWithSearchQuery方法(这可以正常工作)因为我想更具体。有一个名为searchWithURL的方法如下所示。我没有看到有关如何构建这些URL的任何文档。它说的一切都必须从spotify开始:搜索。之后会发生什么?如何指定艺术家,专辑,歌曲?谢谢!
/** Creates a new SPSearch with the default page size from the given Spotify search URL.
This convenience method is simply returns a new, autoreleased SPSearch
object. No caching is performed.
@warning If you pass in an invalid search URL (i.e., any URL not
starting `spotify:search:`, this method will return `nil`.
@warning The search query will be sent to the Spotify search service
immediately. Be sure you want to perform the search before creating the object!
@param searchURL The search URL to create an SPSearch for.
@param aSession The SPSession the track should exist in.
@return Returns the created SPSearch object.
*/
+(SPSearch *)searchWithURL:(NSURL *)searchURL inSession:(SPSession *)aSession;
答案 0 :(得分:2)
搜索URL由SPSearch
个实例创建后创建,它们基本上对您第一次传递的查询进行编码。因此,searchWithURL:
对您来说不会比使用查询创建搜索更有用。
但是,要回答更广泛的问题,您可以使用Spotify Advanced Search Syntax和SPSearch
进行更准确的搜索。
例如,要找到名为“Roar”的曲目:
[SPSearch searchWithSearchQuery:@"track:Roar"
inSession:[SPSession sharedSession]];
找到Katy Perry准确命名为“Roar”的曲目:
[SPSearch searchWithSearchQuery:@"track:Roar artist:\"Katy Perry\""
inSession:[SPSession sharedSession]];
......等等。查看链接页面了解更多详情。