2016-05-05 12 views
1

ユーザーのすべてのフォローを繰り返し、ユーザー名をリストしたいと思います。現時点で私が得ることのできるものは、何もすることができない次の情報の大部分を含むオブジェクトです。私がしたいのは、以下のようにしてユーザー名を取得し、これらのユーザー名を配列にプッシュすることです。助言がありますか?SoundCloud API - ユーザーのフォローのユーザー名を一覧表示する

あなたが行くここ
 SC.get('/me/followings',function(followings) { 


      console.log(followings); 

      // For loop iterating through all of the user's followings 
      for(i = 0; i < followings.length; i++) 
      { 
       // Push all of these likes into the 'meGenrePref' array 
       console.log(followings[i].username); 

      } 
     }); 
+0

である必要があり、それはあなたにあるものは何でも "* *以下の情報" を追加してください質問。私たちのほとんどは、SoundCloudへの準備ができたAPIキーを持っていません。 – Uzbekjon

+0

あなたのコメントからあなたの 'oauth_token'を削除してください。それは公然と共有されるべきではありません。 – Uzbekjon

答えて

1

var meGenrePref = []; 

SC.get('/me/followings',function(followings) { 
    for(i = 0; i < followings.collection.length; i++) { 
     meGenrePref[i] = followings.collection[i].username; 
    } 
}); 

が生成されます

["Tom Misch", "fabric", "SØNDER.", "NIGHT CULT FM", "Mafia Kiss", "PUNKS MUSIC (FREE DOWNLOADS)", "Beatslappaz", "UFO-PROJECT", "BICEP", "MARTEN HØRGER", "MattWills", "Negativ", "Ollie James", "Saucy Music", "Ben Read", "Barely Royal", "INKLINE", "Bunk Audio", "Isenb3rg", "BUNNIE", "Ones", "Bachelors Of Science", "Aurbs", "JoeK", "Gramatik", "Al Pack", "Anita Magenta", "Gold Panda", "Ride.", "LYD", "Delo", "DJOKO", "Hushh", "Fête", "NOVKA", "Plump Djs", "Jaded", "Nu Aspect", "Rico Tubbs", "Saucy Vibes", "Nayla", "SOUNDMOOSE", "The Busy Twist", "EskyBeat", "BLANDA", "Kimyan Law", "Chris Gresswell", "Night Bass", "Blu Mar Ten", "MassMatiks"] 
0

コードが

var users = []; 

SC.get('/me/followings',function(followings) { 
    for(i = 0; i < followings.collection.length; i++) { 
     users[i] = followings.collection[i].username; 
    } 
}); 
関連する問題