Advertisement
Guest User

Untitled

a guest
Apr 7th, 2016
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. SOUNDCLOUDAPI = require('soundcloud-nodejs-api-wrapper');
  2. var JACCESS = require('jsonfile');
  3.  
  4. var SCcredentials = {
  5. client_id : 'a1bba234127704809008652469007c47', // Soundcloud app client id
  6. client_secret : '6eead97a7561d9b609a4df0b2bdef82e', // SoundCloud app secret
  7. username : 'ronkrt.mobile@gmail.com', // SoundCloud Username
  8. password : '' // SoundCloud Password
  9. };
  10.  
  11. var SCconfig = {
  12. gSections : [
  13. 'comments', // Get Profile Comments for user (prase for tipping)
  14. 'followers', // Get Follower information (User IDS)
  15. 'tracks' // Get Track Information (Track IDS)
  16. ],
  17. gInfo : [
  18. '14859705', // SoundPosition
  19. '4182848', // Rouviere
  20. '83205644' // thecypherfunks
  21. ]
  22.  
  23. };
  24.  
  25. var SOUNDCLOUDAPIC = new SOUNDCLOUDAPI(SCcredentials);
  26.  
  27. var SCCLIENT = SOUNDCLOUDAPIC.client();
  28.  
  29. SCCLIENT.exchange_token(function(err, result) {
  30.  
  31. var SCACCESSTOKEN = arguments[3].access_token;
  32.  
  33. console.log('Full API auth response was:');
  34. console.log(arguments);
  35.  
  36. var SCCNEW = SOUNDCLOUDAPIC.client({access_token : SCACCESSTOKEN});
  37.  
  38. for (i = 0; i < SCconfig.gSections.length; i++) {
  39. // Add code
  40. console.log(SCconfig.gSections[i]);
  41. }
  42.  
  43. for (i = 0; i < SCconfig.gInfo.length; i++) {
  44.  
  45. SCconfig.gSections.forEach(function (item) {
  46.  
  47. SCCNEW.get('/users/' + SCconfig.gInfo[i] +'/comments', {limit : 1000000}, function(err, result) {
  48. if (err) console.log(err);
  49. var file = './' + SCconfig.gInfo[i] + '-comments.json'
  50. JACCESS.writeFileSync(file, result, {spaces: 1});
  51.  
  52. console.log(SCconfig.gInfo[i]);
  53.  
  54. })
  55.  
  56. });
  57.  
  58. }
  59.  
  60.  
  61. //SCCNEW.get('/users/14859705/comments', {limit : 10000000}, function(err, result) {
  62. // if (err) console.error(err); // check for an error
  63. // var file = './14859705-profile-comments.json' // create a profile comments json file
  64. // JACCESS.writeFileSync(file, result, {spaces: 2}); // Write the file to disk with json Spacing of 2
  65. //});
  66.  
  67.  
  68. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement