Skip to content

Instantly share code, notes, and snippets.

@sauravtom
Created March 2, 2013 03:15
Show Gist options
  • Select an option

  • Save sauravtom/5069531 to your computer and use it in GitHub Desktop.

Select an option

Save sauravtom/5069531 to your computer and use it in GitHub Desktop.
Bookmarktlet that is supposed to download vimeo video, but doesn't work.and i know why.
javascript: (function () {
var vim_id = document.URL.substring(17);
var url = 'http://player.vimeo.com/play_redirect?quality=hd&codecs=h264&clip_id='
+vim_id+
'&time=1362143485&sig=e846af3c50137c059ea2099a220a1f8b&type=html5_desktop_local';
saveToDisk(url, document.URL+'.mp4');
console.log(url);
function saveToDisk(fileUrl, fileName) {
var save = document.createElement("a");
save.href = fileUrl;
save.target = "_blank";
save.download = fileName || fileUrl;
var evt = document.createEvent('MouseEvents');
evt.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
save.dispatchEvent(evt);
(window.URL || window.webkitURL).revokeObjectURL(save.href)
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment