This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
2012-03-26 Forked from duncanbeevers' sc-dl.js : https://gist.github.com/2157987 | |
**/ | |
(function(document) { | |
var link = document.createElement("a"), | |
span = document.createElement("span"), | |
slug = document.querySelector("#main-content-inner img[class=waveform]").src.match(/\.com\/(.+)\_/)[1], | |
mp3 = document.querySelector("em").innerText + ".mp3"; |