soundcloud load audio track and use client to get it


/ Published in: Bash
Save to your folder(s)

get token
upload track
download track to client ( request --> REDIRECT --> follow it to get download


Copy this code and paste it in your HTML
  1. get token
  2.  
  3. $ curl "https://api.soundcloud.com/oauth2/token" -k -d \
  4. 'client_id=_myID' -d 'client_secret=_mysecret' -d \
  5. 'grant_type=password' -d 'username=_myaccount' -d 'password=_mypass'
  6.  
  7.  
  8. {"access_token":"ee19aa5fe5c278b415a4b6d54006d234","expires_in":3599,"scope":"*","refresh_token":"a4609c76e564ac34da1ee4a929645152"}
  9.  
  10. use the token from response above to upload
  11.  
  12. $ curl -X POST "https://api.soundcloud.com/tracks.json" \
  13. -k -F 'oauth_token=09b1d5655e257c841c5e34b50203aef2' -F \
  14. 'track[asset_data][email protected]' -F \
  15. 'track[title]=voice-clip' -F 'track[sharing]=public' -F \
  16. 'track[downloadable]=true'
  17.  
  18.  
  19. {"id":19700899,"created_at":"2011/07/24 21:41:03 +0000","user_id":6193466,"duration":0,"commentable":true,"state":"storing","sharing":"public","tag_list":"","pe
  20. rmalink":"test-voice-clip","description":null,"streamable":true,"downloadable":true,"genre":null,"release":null,"purchase_url":null,"label_id":null,"label_name
  21. ":null,"isrc":null,"video_url":null,"track_type":null,"key_signature":null,"bpm":null,"title":"test-voice-clip","release_year":null,"release_month":null,"releas
  22. e_day":null,"original_format":"unknown","license":"all-rights-reserved","uri":"https://api.soundcloud.com/tracks/19700899","permalink_url":"http://soundcloud.co
  23. m/user1283899/test-voice-clip","artwork_url":null,"waveform_url":"http://a1.sndcdn.com/images/player-waveform-medium.png?1893888","user":{"id":6193466,"permalin
  24. k":"user1283899","username":"user1283899","uri":"https://api.soundcloud.com/users/6193466","permalink_url":"http://soundcloud.com/user1283899","avatar_url":"htt
  25. p://a1.sndcdn.com/images/default_avatar_large.png?1893888"},
  26. "stream_url":"https://api.soundcloud.com/tracks/19700899/stream",
  27. "download_url":"https://api.soundcloud.com/tracks/19700899/download",
  28. "downloads_remaining":100,"secret_token":"s-SRAjD","secret_uri":"https://api.soundcloud.com/tracks/19700899?secret_token=s-SRA
  29. jD","user_playback_count":1,"user_favorite":false,"playback_count":0,"download_count":0,"favoritings_count":0,"comment_count":0,"created_with":{"id":29714,"name
  30. ":"borneo","uri":"https://api.soundcloud.com/apps/29714","permalink_url":"http://soundcloud.com/apps/borneo"},"attachments_uri":"https://api.soundcloud.com/trac
  31. ks/19700899/attachments"}
  32.  
  33.  
  34. download song: MUST B DOWNLOADable in the metadata for the track
  35.  
  36. Request URL:https://api.soundcloud.com/tracks/19700899/download?client_id=_myID
  37. Request Method:GET
  38. Status Code:302 Moved Temporarily
  39.  
  40. 'parse Location: header to get new url'
  41.  
  42. Access-Control-Allow-Headers:Authorization, Content-Type, Accept
  43. Access-Control-Allow-Methods:GET, PUT, POST, DELETE
  44. Access-Control-Allow-Origin:*
  45. Cache-Control:no-cache
  46. Connection:keep-alive
  47. Content-Length:269
  48. Content-Type:text/html; charset=utf-8
  49. Date:Mon, 25 Jul 2011 02:27:04 GMT
  50. Location:http://ak-media.soundcloud.com/P9l8r4x03dpy?AWSAccessKeyId=AKIAJBHW5FB4ERKUQUOQ&Expires=1311560844&Signature=sI4M8AFXHahHrZX9a37cV4sMHaA%3D&__gda__=1311560844_a5e7bce208cac02536f3395b6a302479
  51.  
  52. 'client follows redirect: getting back the same file that was uploaded'
  53.  
  54. Request URL:http://ak-media.soundcloud.com/P9l8r4x03dpy?AWSAccessKeyId=AKIAJBHW5FB4ERKUQUOQ&Expires=1311560844&Signature=sI4M8AFXHahHrZX9a37cV4sMHaA%3D&__gda__=1311560844_a5e7bce208cac02536f3395b6a302479
  55. Request Method:GET
  56. Status Code:200 OK
  57. Request Headersview source
  58. Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  59. Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
  60. Accept-Encoding:gzip,deflate,sdch
  61. Accept-Language:en-US,en;q=0.8
  62. Connection:keep-alive
  63. Cookie:__qca=P0-295632680-1311524594186; qu=Infinity; qp=3; qs=100; qc=1; qn=20; qg=1; u=user1283899; p=user1283899; l=0; c=free; _soundcloud_session=BAh7CDoPc2Vzc2lvbl9pZCIlODAyZmYzYjljNDljZGU0MmQ1NjliMzY5YmJhODY3MTU6CXVzZXJpAzqBXjoQX2NzcmZfdG9rZW5JIjFtNHZ5QjExa3pMblVzRW9CK2p2dnROeTh0ZGtkYzUxb1FxR2RWWjRTYzRvPQY6BkVG--47d754b5322db347286598b2c5b59ee1eb1431ed; __utmx=179375142.; __utmxx=179375142.; r=1; __utma=179375142.440645041.1311524594.1311541676.1311545519.3; __utmc=179375142; __utmz=179375142.1311545519.3.3.utmcsr=developers.soundcloud.com|utmccn=(referral)|utmcmd=referral|utmcct=/docs/api/authentication; __utmv=179375142.|1=plan=free=1
  64. Host:ak-media.soundcloud.com
  65. User-Agent:Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1
  66. Query String Parametersview URL encoded
  67. AWSAccessKeyId:AKIAJBHW5FB4ERKUQUOQ
  68. Expires:1311560844
  69. Signature:sI4M8AFXHahHrZX9a37cV4sMHaA=
  70. __gda__:1311560844_a5e7bce208cac02536f3395b6a302479
  71. Response Headersview source
  72. Accept-Ranges:bytes
  73. Cache-Control:max-age=31534638
  74. Connection:keep-alive
  75. Content-Disposition:attachment;filename="recording1147240752.3gpp"
  76. Content-Length:21915
  77. Content-Type:video/3gpp
  78. Date:Mon, 25 Jul 2011 02:27:04 GMT
  79. ETag:"7faef5a13515b7612ed7dfb664edfee9"
  80. Last-Modified:Sun, 24 Jul 2011 21:41:09 GMT
  81. Server:AmazonS3
  82. x-amz-id-2:aoFyAe+icJ5htwVk+CWtKWSayTShEfLoyhMBJUALxNr08NEtaoQJqghJ8Iwk3thX
  83. x-amz-meta-duration:29031
  84. x-amz-meta-file-type:raw
  85. x-amz-meta-user-id:6193466
  86. x-amz-request-id:41F6A8DF69C83B6E

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.