Skip to content

Commit 38d25d0

Browse files
committed
Merge pull request #8 from JMPerez/add-browse
Added New Releases and Featured Playlists
2 parents 8e234fa + d631585 commit 38d25d0

File tree

4 files changed

+893
-1
lines changed

4 files changed

+893
-1
lines changed

src/spotify-web-api.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ var SpotifyWebApi = (function() {
441441
* @return {Object} Null if a callback is provided, a `Promise` object otherwise
442442
*/
443443
Constr.prototype.removeTracksFromPlaylistWithSnapshotId = function(userId, playlistId, uris, snapshotId, callback) {
444+
/*jshint camelcase: false */
444445
var dataToBeSent = uris.map(function(uri) {
445446
if (typeof uri === 'string') {
446447
return { uri: uri };
@@ -643,6 +644,38 @@ var SpotifyWebApi = (function() {
643644
return _checkParamsAndPerformRequest(requestData, options, callback);
644645
};
645646

647+
/**
648+
* Fetches a list of Spotify featured playlists (shown, for example, on a Spotify player's "Browse" tab).
649+
* See [Get a List of Featured Playlists](https://developer.spotify.com/web-api/get-list-featured-playlists/) on
650+
* the Spotify Developer site for more information about the endpoint.
651+
* @param {Object} options A JSON object with options that can be passed
652+
* @param {function(Object, Object)} callback An optional callback that receives 2 parameters. The first
653+
* one is the error object (null if no error), and the second is the value if the request succeeded.
654+
* @return {Object} Null if a callback is provided, a `Promise` object otherwise
655+
*/
656+
Constr.prototype.getFeaturedPlaylists = function(options, callback) {
657+
var requestData = {
658+
url: _baseUri + '/browse/featured-playlists'
659+
};
660+
return _checkParamsAndPerformRequest(requestData, options, callback);
661+
};
662+
663+
/**
664+
* Fetches a list of new album releases featured in Spotify (shown, for example, on a Spotify player's "Browse" tab).
665+
* See [Get a List of New Releases](https://developer.spotify.com/web-api/get-list-new-releases/) on
666+
* the Spotify Developer site for more information about the endpoint.
667+
* @param {Object} options A JSON object with options that can be passed
668+
* @param {function(Object, Object)} callback An optional callback that receives 2 parameters. The first
669+
* one is the error object (null if no error), and the second is the value if the request succeeded.
670+
* @return {Object} Null if a callback is provided, a `Promise` object otherwise
671+
*/
672+
Constr.prototype.getNewReleases = function(options, callback) {
673+
var requestData = {
674+
url: _baseUri + '/browse/new-releases'
675+
};
676+
return _checkParamsAndPerformRequest(requestData, options, callback);
677+
};
678+
646679
/**
647680
* Fetches albums from the Spotify catalog according to a query.
648681
* See [Search for an Item](https://developer.spotify.com/web-api/search-item/) on
Lines changed: 336 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,336 @@
1+
{
2+
"message" : "Feeling nostalgic this afternoon?",
3+
"playlists" : {
4+
"href" : "https://api.spotify.com/v1/browse/featured-playlists?timestamp=2014-10-23T15:37:39&offset=0&limit=20",
5+
"items" : [ {
6+
"collaborative" : false,
7+
"external_urls" : {
8+
"spotify" : "http://open.spotify.com/user/spotify/playlist/4ORiMCgOe6UxBDqW8SF1Lm"
9+
},
10+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/4ORiMCgOe6UxBDqW8SF1Lm",
11+
"id" : "4ORiMCgOe6UxBDqW8SF1Lm",
12+
"images" : [ {
13+
"url" : "https://i.scdn.co/image/de9f55660bc0abbbd36ac43acb80ced3c03da768"
14+
} ],
15+
"name" : "#ThrowbackThursday",
16+
"owner" : {
17+
"external_urls" : {
18+
"spotify" : "http://open.spotify.com/user/spotify"
19+
},
20+
"href" : "https://api.spotify.com/v1/users/spotify",
21+
"id" : "spotify",
22+
"type" : "user",
23+
"uri" : "spotify:user:spotify"
24+
},
25+
"public" : null,
26+
"tracks" : {
27+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/4ORiMCgOe6UxBDqW8SF1Lm/tracks",
28+
"total" : 24
29+
},
30+
"type" : "playlist",
31+
"uri" : "spotify:user:spotify:playlist:4ORiMCgOe6UxBDqW8SF1Lm"
32+
}, {
33+
"collaborative" : false,
34+
"external_urls" : {
35+
"spotify" : "http://open.spotify.com/user/spotify/playlist/51HFHO33vXhvUElwtD9eBD"
36+
},
37+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/51HFHO33vXhvUElwtD9eBD",
38+
"id" : "51HFHO33vXhvUElwtD9eBD",
39+
"images" : [ {
40+
"url" : "https://i.scdn.co/image/d64625b16b7ca5077e84af83a4700cdf1761ee6d"
41+
} ],
42+
"name" : "Neo Soul",
43+
"owner" : {
44+
"external_urls" : {
45+
"spotify" : "http://open.spotify.com/user/spotify"
46+
},
47+
"href" : "https://api.spotify.com/v1/users/spotify",
48+
"id" : "spotify",
49+
"type" : "user",
50+
"uri" : "spotify:user:spotify"
51+
},
52+
"public" : null,
53+
"tracks" : {
54+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/51HFHO33vXhvUElwtD9eBD/tracks",
55+
"total" : 66
56+
},
57+
"type" : "playlist",
58+
"uri" : "spotify:user:spotify:playlist:51HFHO33vXhvUElwtD9eBD"
59+
}, {
60+
"collaborative" : false,
61+
"external_urls" : {
62+
"spotify" : "http://open.spotify.com/user/spotify/playlist/16BpjqQV1Ey0HeDueNDSYz"
63+
},
64+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/16BpjqQV1Ey0HeDueNDSYz",
65+
"id" : "16BpjqQV1Ey0HeDueNDSYz",
66+
"images" : [ {
67+
"url" : "https://i.scdn.co/image/a7814e486f761990c9c73672aaa0cbdbaa5983e7"
68+
} ],
69+
"name" : "Afternoon Acoustic",
70+
"owner" : {
71+
"external_urls" : {
72+
"spotify" : "http://open.spotify.com/user/spotify"
73+
},
74+
"href" : "https://api.spotify.com/v1/users/spotify",
75+
"id" : "spotify",
76+
"type" : "user",
77+
"uri" : "spotify:user:spotify"
78+
},
79+
"public" : null,
80+
"tracks" : {
81+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/16BpjqQV1Ey0HeDueNDSYz/tracks",
82+
"total" : 116
83+
},
84+
"type" : "playlist",
85+
"uri" : "spotify:user:spotify:playlist:16BpjqQV1Ey0HeDueNDSYz"
86+
}, {
87+
"collaborative" : false,
88+
"external_urls" : {
89+
"spotify" : "http://open.spotify.com/user/spotify/playlist/4PVvyd4T99XWeIZOFMbT7k"
90+
},
91+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/4PVvyd4T99XWeIZOFMbT7k",
92+
"id" : "4PVvyd4T99XWeIZOFMbT7k",
93+
"images" : [ {
94+
"url" : "https://i.scdn.co/image/9c3aaec17296bd06a93cf3b8af2c1ea31a099293"
95+
} ],
96+
"name" : "Retro Pop",
97+
"owner" : {
98+
"external_urls" : {
99+
"spotify" : "http://open.spotify.com/user/spotify"
100+
},
101+
"href" : "https://api.spotify.com/v1/users/spotify",
102+
"id" : "spotify",
103+
"type" : "user",
104+
"uri" : "spotify:user:spotify"
105+
},
106+
"public" : null,
107+
"tracks" : {
108+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/4PVvyd4T99XWeIZOFMbT7k/tracks",
109+
"total" : 135
110+
},
111+
"type" : "playlist",
112+
"uri" : "spotify:user:spotify:playlist:4PVvyd4T99XWeIZOFMbT7k"
113+
}, {
114+
"collaborative" : false,
115+
"external_urls" : {
116+
"spotify" : "http://open.spotify.com/user/spotify/playlist/7iiRP3LZPuuoE4dBWWufkw"
117+
},
118+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/7iiRP3LZPuuoE4dBWWufkw",
119+
"id" : "7iiRP3LZPuuoE4dBWWufkw",
120+
"images" : [ {
121+
"url" : "https://i.scdn.co/image/ab4f838da13bb0b2929accdaa9a0f11cefb0e7a1"
122+
} ],
123+
"name" : "Bring Back the 90s",
124+
"owner" : {
125+
"external_urls" : {
126+
"spotify" : "http://open.spotify.com/user/spotify"
127+
},
128+
"href" : "https://api.spotify.com/v1/users/spotify",
129+
"id" : "spotify",
130+
"type" : "user",
131+
"uri" : "spotify:user:spotify"
132+
},
133+
"public" : null,
134+
"tracks" : {
135+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/7iiRP3LZPuuoE4dBWWufkw/tracks",
136+
"total" : 61
137+
},
138+
"type" : "playlist",
139+
"uri" : "spotify:user:spotify:playlist:7iiRP3LZPuuoE4dBWWufkw"
140+
}, {
141+
"collaborative" : false,
142+
"external_urls" : {
143+
"spotify" : "http://open.spotify.com/user/spotify/playlist/2Qi8yAzfj1KavAhWz1gaem"
144+
},
145+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/2Qi8yAzfj1KavAhWz1gaem",
146+
"id" : "2Qi8yAzfj1KavAhWz1gaem",
147+
"images" : [ {
148+
"url" : "https://i.scdn.co/image/9d820048e10707dc0ac7ddae33a34bb2b0d10a2a"
149+
} ],
150+
"name" : "Rock Classics",
151+
"owner" : {
152+
"external_urls" : {
153+
"spotify" : "http://open.spotify.com/user/spotify"
154+
},
155+
"href" : "https://api.spotify.com/v1/users/spotify",
156+
"id" : "spotify",
157+
"type" : "user",
158+
"uri" : "spotify:user:spotify"
159+
},
160+
"public" : null,
161+
"tracks" : {
162+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/2Qi8yAzfj1KavAhWz1gaem/tracks",
163+
"total" : 92
164+
},
165+
"type" : "playlist",
166+
"uri" : "spotify:user:spotify:playlist:2Qi8yAzfj1KavAhWz1gaem"
167+
}, {
168+
"collaborative" : false,
169+
"external_urls" : {
170+
"spotify" : "http://open.spotify.com/user/spotify/playlist/44XJR1i3Vl2B3acOEYwinE"
171+
},
172+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/44XJR1i3Vl2B3acOEYwinE",
173+
"id" : "44XJR1i3Vl2B3acOEYwinE",
174+
"images" : [ {
175+
"url" : "https://i.scdn.co/image/78280176866b4438f27acc7950555d3155876ecd"
176+
} ],
177+
"name" : "Power Ballads",
178+
"owner" : {
179+
"external_urls" : {
180+
"spotify" : "http://open.spotify.com/user/spotify"
181+
},
182+
"href" : "https://api.spotify.com/v1/users/spotify",
183+
"id" : "spotify",
184+
"type" : "user",
185+
"uri" : "spotify:user:spotify"
186+
},
187+
"public" : null,
188+
"tracks" : {
189+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/44XJR1i3Vl2B3acOEYwinE/tracks",
190+
"total" : 79
191+
},
192+
"type" : "playlist",
193+
"uri" : "spotify:user:spotify:playlist:44XJR1i3Vl2B3acOEYwinE"
194+
}, {
195+
"collaborative" : false,
196+
"external_urls" : {
197+
"spotify" : "http://open.spotify.com/user/spotify/playlist/2NFOUmp2wyR5CrXtKDkUkB"
198+
},
199+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/2NFOUmp2wyR5CrXtKDkUkB",
200+
"id" : "2NFOUmp2wyR5CrXtKDkUkB",
201+
"images" : [ {
202+
"url" : "https://i.scdn.co/image/9ae8f6bf396c435adc6a3288f22beea89f96c099"
203+
} ],
204+
"name" : "Bring Back the 60's",
205+
"owner" : {
206+
"external_urls" : {
207+
"spotify" : "http://open.spotify.com/user/spotify"
208+
},
209+
"href" : "https://api.spotify.com/v1/users/spotify",
210+
"id" : "spotify",
211+
"type" : "user",
212+
"uri" : "spotify:user:spotify"
213+
},
214+
"public" : null,
215+
"tracks" : {
216+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/2NFOUmp2wyR5CrXtKDkUkB/tracks",
217+
"total" : 67
218+
},
219+
"type" : "playlist",
220+
"uri" : "spotify:user:spotify:playlist:2NFOUmp2wyR5CrXtKDkUkB"
221+
}, {
222+
"collaborative" : false,
223+
"external_urls" : {
224+
"spotify" : "http://open.spotify.com/user/spotify/playlist/4jONxQje1Fmw9AFHT7bCp8"
225+
},
226+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/4jONxQje1Fmw9AFHT7bCp8",
227+
"id" : "4jONxQje1Fmw9AFHT7bCp8",
228+
"images" : [ {
229+
"url" : "https://i.scdn.co/image/1fb8c82d01eef0dd860c7a74e604e0d332bd50dc"
230+
} ],
231+
"name" : "Old School Hip Hop",
232+
"owner" : {
233+
"external_urls" : {
234+
"spotify" : "http://open.spotify.com/user/spotify"
235+
},
236+
"href" : "https://api.spotify.com/v1/users/spotify",
237+
"id" : "spotify",
238+
"type" : "user",
239+
"uri" : "spotify:user:spotify"
240+
},
241+
"public" : null,
242+
"tracks" : {
243+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/4jONxQje1Fmw9AFHT7bCp8/tracks",
244+
"total" : 84
245+
},
246+
"type" : "playlist",
247+
"uri" : "spotify:user:spotify:playlist:4jONxQje1Fmw9AFHT7bCp8"
248+
}, {
249+
"collaborative" : false,
250+
"external_urls" : {
251+
"spotify" : "http://open.spotify.com/user/spotify/playlist/0c8Y6trDz57umvTPFlo1zF"
252+
},
253+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/0c8Y6trDz57umvTPFlo1zF",
254+
"id" : "0c8Y6trDz57umvTPFlo1zF",
255+
"images" : [ {
256+
"url" : "https://i.scdn.co/image/a4ac931e334d14c24579dbda0c1716b31d2e0f91"
257+
} ],
258+
"name" : "Femme Fatale",
259+
"owner" : {
260+
"external_urls" : {
261+
"spotify" : "http://open.spotify.com/user/spotify"
262+
},
263+
"href" : "https://api.spotify.com/v1/users/spotify",
264+
"id" : "spotify",
265+
"type" : "user",
266+
"uri" : "spotify:user:spotify"
267+
},
268+
"public" : null,
269+
"tracks" : {
270+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/0c8Y6trDz57umvTPFlo1zF/tracks",
271+
"total" : 79
272+
},
273+
"type" : "playlist",
274+
"uri" : "spotify:user:spotify:playlist:0c8Y6trDz57umvTPFlo1zF"
275+
}, {
276+
"collaborative" : false,
277+
"external_urls" : {
278+
"spotify" : "http://open.spotify.com/user/spotify/playlist/42zGB0WsGn8nb1SCS3xtQr"
279+
},
280+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/42zGB0WsGn8nb1SCS3xtQr",
281+
"id" : "42zGB0WsGn8nb1SCS3xtQr",
282+
"images" : [ {
283+
"url" : "https://i.scdn.co/image/96454a691a1170f21d77f9802521ddfcf9d085f1"
284+
} ],
285+
"name" : "California Sun",
286+
"owner" : {
287+
"external_urls" : {
288+
"spotify" : "http://open.spotify.com/user/spotify"
289+
},
290+
"href" : "https://api.spotify.com/v1/users/spotify",
291+
"id" : "spotify",
292+
"type" : "user",
293+
"uri" : "spotify:user:spotify"
294+
},
295+
"public" : null,
296+
"tracks" : {
297+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/42zGB0WsGn8nb1SCS3xtQr/tracks",
298+
"total" : 26
299+
},
300+
"type" : "playlist",
301+
"uri" : "spotify:user:spotify:playlist:42zGB0WsGn8nb1SCS3xtQr"
302+
}, {
303+
"collaborative" : false,
304+
"external_urls" : {
305+
"spotify" : "http://open.spotify.com/user/spotify/playlist/4bWgWsz9p9eZVtpIvBgbsj"
306+
},
307+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/4bWgWsz9p9eZVtpIvBgbsj",
308+
"id" : "4bWgWsz9p9eZVtpIvBgbsj",
309+
"images" : [ {
310+
"url" : "https://i.scdn.co/image/abb30d1f84ff24ab8c7cb2887814e53ff164a3e9"
311+
} ],
312+
"name" : "From a Smokey Bar ",
313+
"owner" : {
314+
"external_urls" : {
315+
"spotify" : "http://open.spotify.com/user/spotify"
316+
},
317+
"href" : "https://api.spotify.com/v1/users/spotify",
318+
"id" : "spotify",
319+
"type" : "user",
320+
"uri" : "spotify:user:spotify"
321+
},
322+
"public" : null,
323+
"tracks" : {
324+
"href" : "https://api.spotify.com/v1/users/spotify/playlists/4bWgWsz9p9eZVtpIvBgbsj/tracks",
325+
"total" : 47
326+
},
327+
"type" : "playlist",
328+
"uri" : "spotify:user:spotify:playlist:4bWgWsz9p9eZVtpIvBgbsj"
329+
} ],
330+
"limit" : 20,
331+
"next" : null,
332+
"offset" : 0,
333+
"previous" : null,
334+
"total" : 12
335+
}
336+
}

0 commit comments

Comments
 (0)