View Single Post
  #2  
Old 02-02-2010, 12:51 AM
any ANONYMOUS forum user any ANONYMOUS forum user is offline
any user of the forum who preferred to post anonymously
 
Join Date: Aug 2011
Location: Server of stream-recorder.com
Posts: 211
any ANONYMOUS forum user is on a distinguished road
Default

Re: Downloading YouTube videos with JavaScript


Try the following bookmarklet
Code:
javascript:(function(){if(document.getElementById('download-youtube-video'))return;var%20args=null,video_title=null,video_id=null,video_hash=null;var%20download_code=new%20Array();var%20fmt_labels={'18':'standard%20MP4','22':'HD%20720p','37':'HD%201080p'};try{args=yt.getConfig('SWF_ARGS');video_title=yt.getConfig('VIDEO_TITLE')}catch(e){}if(args){var%20fmt_url_map=unescape(args['fmt_url_map']);if(fmt_url_map=='')return;video_id=args['video_id'];video_hash=args['t'];video_title=video_title.replace(/[%22\'\?\\\/\:\*%3C%3E]/g,'');var%20fmt=new%20Array();var%20formats=fmt_url_map.split(',');var%20format;for(var%20i=0;i%3Cformats.length;i++){var%20format_elems=formats[i].split('|');fmt[format_elems[0]]=unescape(format_elems[1])}for(format%20in%20fmt_labels){if(fmt[format]!=null){download_code.push('%3Ca%20href=\''+(fmt[format]+'&title='+video_title)+'\'%3E'+fmt_labels[format]+'%3C/a%3E')}else%20if(format=='18'){download_code.push('%3Ca%20href=\'http://www.youtube.com/get_video?fmt=18&video_id='+video_id+'&t='+video_hash+'\'%3E'+fmt_labels[format]+'%3C/a%3E')}}}if(video_id==null||video_hash==null)return;var%20div_embed=document.getElementById('watch-embed-div');if(div_embed){var%20div_download=document.createElement('div');div_download.innerHTML='%3Cbr%20/%3E%3Cspan%20id=\'download-youtube-video\'%3EDownload:%20'+download_code.join('%20|%20')+'%3C/span%3E';div_embed.appendChild(div_download)}})();void(0)
Reply With Quote