Log in

View Full Version : Better configuring a Javascript Youtube Downloader


Cyber Akuma
25th February 2009, 00:19
I hope I posted this in the right section because I have no idea where to post this:

I know next to nothing about web design and programming

I was googling on downloading youtube videos and came across this:

http://www.macosxhints.com/article.php?story=20081125213451807

Putting this into my address bar or into a bookmark and loading it while on a youtube page adds a download link..... but only for the 720P version.... which most youtube videos do not have.

So, I looked though the code and noticed a part that mentioned "?fmt=22"

I remembered reading that adding this to the end of a youtube URL loads the 720P version of a video.

So I googled for other versions and found 6 and 18

So I created these three scripts based off the original script:

Original SD FLV:
javascript:if%20(document.getElementById('download-youtube-video')==null%20&&%20!!(document.location.href.match(/http:%5C/%5C/%5Ba-zA-Z%5C.%5D*youtube%5C.com%5C/watch/)))%20%7Bvar%20yt_mp4_path='http://www.youtube.com/get_video?fmt=6&video_id='+swfArgs%5B'video_id'%5D+'&t='+swfArgs%5B't'%5D;%20var%20div_embed=document.getElementById('watch-embed-div');div_embed.innerHTML=div_embed.innerHTML+'%3Cbr%20/%3E%20%3Cspan%20id=%5C'download-youtube-video%5C'%3E%3Ca%20href=%5C''+yt_mp4_path+'%5C'%3EDownload%20as%20Original%20SD%20FLV%3C/a%3E%20'+%20%20((navigator.userAgent.indexOf('Safari')!=-1)?'(control-click%20and%20select%20%3Ci%3EDownload%20linked%20file%20as%3C/i%3E)':('(right-click%20and%20select%20%3Ci%3ESave%20'+%20(navigator.appName=='Microsoft%20Internet%20Explorer'?'target':'link')%20+'%20as)%3C/i%3E'))+'%3C/span%3E';%7Dvoid(0)

Medium Quality MP4:
javascript:if%20(document.getElementById('download-youtube-video')==null%20&&%20!!(document.location.href.match(/http:%5C/%5C/%5Ba-zA-Z%5C.%5D*youtube%5C.com%5C/watch/)))%20%7Bvar%20yt_mp4_path='http://www.youtube.com/get_video?fmt=18&video_id='+swfArgs%5B'video_id'%5D+'&t='+swfArgs%5B't'%5D;%20var%20div_embed=document.getElementById('watch-embed-div');div_embed.innerHTML=div_embed.innerHTML+'%3Cbr%20/%3E%20%3Cspan%20id=%5C'download-youtube-video%5C'%3E%3Ca%20href=%5C''+yt_mp4_path+'%5C'%3EDownload%20as%20Medium%20Quality%20MP4%3C/a%3E%20'+%20%20((navigator.userAgent.indexOf('Safari')!=-1)?'(control-click%20and%20select%20%3Ci%3EDownload%20linked%20file%20as%3C/i%3E)':('(right-click%20and%20select%20%3Ci%3ESave%20'+%20(navigator.appName=='Microsoft%20Internet%20Explorer'?'target':'link')%20+'%20as)%3C/i%3E'))+'%3C/span%3E';%7Dvoid(0)

And the original 720p MP4:
javascript:if%20(document.getElementById('download-youtube-video')==null%20&&%20!!(document.location.href.match(/http:%5C/%5C/%5Ba-zA-Z%5C.%5D*youtube%5C.com%5C/watch/)))%20%7Bvar%20yt_mp4_path='http://www.youtube.com/get_video?fmt=22&video_id='+swfArgs%5B'video_id'%5D+'&t='+swfArgs%5B't'%5D;%20var%20div_embed=document.getElementById('watch-embed-div');div_embed.innerHTML=div_embed.innerHTML+'%3Cbr%20/%3E%20%3Cspan%20id=%5C'download-youtube-video%5C'%3E%3Ca%20href=%5C''+yt_mp4_path+'%5C'%3EDownload%20as%20720p%20HD%20MP4%3C/a%3E%20'+%20%20((navigator.userAgent.indexOf('Safari')!=-1)?'(control-click%20and%20select%20%3Ci%3EDownload%20linked%20file%20as%3C/i%3E)':('(right-click%20and%20select%20%3Ci%3ESave%20'+%20(navigator.appName=='Microsoft%20Internet%20Explorer'?'target':'link')%20+'%20as)%3C/i%3E'))+'%3C/span%3E';%7Dvoid(0)

Now, I have two problems with these:

1. ..... Did I get all of these right?

Is FMT=6 the original quality FLV? Is FMT=18 the medium quality MP4 or something else? What about the HD version of FLV? Which I know exists...

I am sure I missed some of the valid FMT codes (e.g., I know that FMT=15 used to download the original file used to upload, but I think they disabled that now).

What am I missing? AFAIK, I should have 5, original FLV, original MP4, Medium FLV, Medium MP4, and 720p MP4.... not sure if there exists a 720p FLV.

2. I can only use one of these at a time, if I load one link, I cannot load another unless I refresh the page to clear the previous link the code added.... is there any way to make it possible to load all of them at once?

Dark Eiri
2nd March 2009, 08:39
fmt=6 is a higher quality FLV. There's also fmt=35, which is a "Higher Quality MP4".

IgorC
13th March 2009, 22:23
&fmt=8 High Quality of .... dont know what

aerodown
14th March 2009, 05:20
javascript:if(document.location.href.match(/http:\/\/[a-zA-Z\.]*youtube\.com\/watch/)){document.location.href='http://www.youtube.com/get_video?fmt=22&video_id='+swfArgs['video_id']+'&t='+swfArgs['t']}

same can bookmark or put in address bar. you can change the fmt=22 to 18 or anything. this doesn't put any download link but it will ask you to save the video.