View Single Post
  #4  
Old 02-02-2010, 12:59 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


And here is another working bookmarklet
Code:
javascript:var fmt=35;var success=0;var fmt_url_map = unescape(yt.getConfig("SWF_ARGS")['fmt_url_map']);var fmt_url_a = fmt_url_map.split(',');for(idx in fmt_url_a){fmt_url_a[idx]=fmt_url_a[idx].split('|');if(fmt_url_a[idx][0]==fmt){window.location.assign(fmt_url_a[idx][1]);success=1;break;}}if(success==0){var err_msg = "Video available in these formats:\n";for(idx in fmt_url_a){switch(fmt_url_a[idx][0]){case '5':err_msg+=".flv FLV1-320x240 MP3-22k-mono fmt=5\n";break;case '18':err_msg+=".mp4 H264-480x360 AAC-44k-st fmt=18\n";break;case '22':err_msg+=".mp4 H264-1280x720 AAC-44k-st fmt=22\n";break;case '34':err_msg+=".flv H264-320x240 AAC-22k-st fmt=34\n";break;case '35':err_msg+=".flv H264-480x368 AAC-44k-st fmt=35\n";break;case '37':err_msg+=".mp4 H264-1920x1080 AAC-44k-st fmt=37\n";break;default:err_msg+="unknown format fmt="+fmt_url_a[idx][0]+"\n";};};alert(err_msg);};
If the video doesn't have the requested fmt version a popup will display available fmt for download. You can replace the value of the variable fmt to download the version you want.

The highest quality version is usually first in the list so the following bookmarklet will download the highest quality video file:
Code:
javascript:var fmt_url_map = unescape(yt.getConfig("SWF_ARGS")['fmt_url_map']);if(fmt_url_map.indexOf(',') != -1){window.location.assign(fmt_url_map.substring(fmt_url_map.indexOf('|')+1, fmt_url_map.indexOf(',')))}else window.location.assign(fmt_url_map.substring(fmt_url_map.indexOf('|')+1));
Reply With Quote