Google Apps Script経由で、SpotifyのAPIを使って、プレイリストを取得してみよう
function myFunction() { var clientId = "set your clientId here"; var clientSecret = "set your client secret here"; var url = "https://accounts.spotify.com/api/token"; var params = { method: "post", headers: { "Authorization": "Basic " + Utilities.base64Encode(clientId + ":" + clientSecret) }, payload: { grant_type: "client_credentials" }, }; var response = UrlFetchApp.fetch(url, params); var access_token = JSON.parse(response.getContentText()).access_token; var playlists = ["4tY0lHoV8IemMBp4iTnKnl", "799Fo9to2TK0ahGEJsvcm2"]; for (var i = 0; i < playlists.length; i++) { var url = "https://api.spotify.com/v1/playlists/" + playlists[i]; var params = { method: 'get', headers: { 'Authorization': 'Bearer ' + access_token } }; var response = UrlFetchApp.fetch(url, params); var data = JSON.parse(response.getContentText()); Logger.log(data.name + " " + data.tracks.items.length) } }