Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CodeOfficer/296812 to your computer and use it in GitHub Desktop.
Save CodeOfficer/296812 to your computer and use it in GitHub Desktop.
javascript:if(!document.getElementById('download-youtube-video')){var%20video_id=null;var%20video_hash=null;var%20video_player=document.getElementById('movie_player');if(video_player){var%20flash_variables=video_player.attributes.getNamedItem('flashvars');if(flash_variables){var%20flash_values=flash_variables.value;if(flash_values){var%20video_id_match=flash_values.match(/[^a-z]video_id=([^(\&|$)]*)/);if(video_id_match!=null)video_id=video_id_match[1];var%20video_hash_match=flash_values.match(/[^a-z]t=([^(\&|$)]*)/);if(video_hash_match!=null)video_hash=video_hash_match[1]}}}if(video_id==null||video_hash==null){var%20args=null;try{args=yt.getConfig('SWF_ARGS')}catch(e){}if(args){video_id=args['video_id'];video_hash=args['t']}}if(video_id!=null&&video_hash!=null){var%20div_embed=document.getElementById('watch-embed-div');if(div_embed){var%20div_download=document.createElement('div');var%20div_download_code='%3Cbr%20/%3E%3Cspan%20id=\'download-youtube-video\'%3E%3Ca%20href=\''+'http://www.youtube.com/get_video?fmt=18&video_id='+video_id+'&t='+video_hash+'\'%20onclick=\'blur(this);\'%3EDownload%20as%20MP4%3C/a%3E';try{if(yt.getConfig('IS_HD_AVAILABLE'))div_download_code=div_download_code+'%20|%20%3Ca%20href=\''+'http://www.youtube.com/get_video?fmt=22&video_id='+video_id+'&t='+video_hash+'\'%20onclick=\'blur(this);\'%3EDownload%20as%20MP4%20HD%3C/a%3E'}catch(e){}div_download.innerHTML=div_download_code+'%3C/span%3E';div_embed.appendChild(div_download)}}}void(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment