Skip to content

Instantly share code, notes, and snippets.

@sinak
Created November 7, 2013 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sinak/7361214 to your computer and use it in GitHub Desktop.
Save sinak/7361214 to your computer and use it in GitHub Desktop.
Add this text as a bookmark to download Soundcloud songs.
javascript: (function(a){var b,c,d,e=$(".sound"),f=require("config").get("client_id"),g=require("lib/connect").getAuthToken(),h=require("lib/helpers/conversion-helper"),i,j,k,l,m;for(b=e.length-1;b>=0;b--){c=$(e[b]);if(0==c.find(".sc-button-download").length){var n="https://soundcloud.com"+(c.find(".soundTitle__title").attr("href")||a.location.pathname);k={url:n,client_id:f},m=function(a){return function(b){var c={client_id:f};l=require("lib/url").stringify({query:c},b.stream_url+".mp3"),d=a.find(".sound__soundActions .sc-button-group"),j=d.find(".sc-button:first")[0].className.match(/sc-button-((?:small)|(?:medium))/)[1],i=$('<a class="sc-button sc-button-download sc-button-icon sc-button-responsive">Download</a>').attr({title:"Download this sound ("+h.bytesToMB(b.original_content_size)+")",href:l}).addClass("sc-button-"+j),d.append(i)}}(c),$.getJSON("http://api.soundcloud.com/resolve.json",k).success(m)}}})(window)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment