Download video from YouTube
Thanks for visiting my site lucky visitor:
This page was last updated on: February 19, 2008
Copyright © 2002. XcelFiles. All Rights Reserved Ivan F Moala



I have had occasions where I was interested in a YouTube video that I may want to watch again, so looked around YouTube to down load it i.e. save to my PC. As you may be aware this is not possible from YouTube. P....s off, I went about looking for a way to download it. Yes I know there are a few YouTube downloaders, but this was a good excuse to see what I could find out.
Here is what I finally came up with;
In reference to the above;
The video ID is jgsWXmY0mx0
If the video is already streamed (i.e. been downloaded into your temp directory, I did find the temp storage file, but it appears to remove itself when you move from the page) then the page contains the info required to download the video and you can get this via the innerHtml property of InternetExplorer.Document. This was my down fall in my original post at MrExcel. Further tests also showed that the Tag changed for each logon session. So what do we do ? We need to look @ the source code for the page to find the variables, but the Document properties will not reveal the source.
Enter the Microsoft XMLHTTP which has been available since Internet Explorer 5.0 and is accessible via JScript, VBScript and other programing applications via referencing the msxml6.dll (early binding)
Using XMLHTTP I was able to find the variables which were contained in;
var swfArgs
{hl:'en',video_id:'jgsWXmY0mx0',l:'115',t:'OEgsToPDskLP
7Nuz7y8KgXbFKIzxVsrF',sk:'EW9EPfaJ2F5EnbBfrS0q4wC'};
From this I was able to ascertain the variables required which were;
'video_id=jgsWXmY0mx0
'&l=115
'&t=OEgsToPDskLP7Nuz7y8KgXbFKIzxVsrF
video_id is the unique video ID
l is the length of the video in seconds
t is the tag used for that particular session.
Now to get this to download we use the command get_video
Putting this together gives us;
get_video?video_id=jgsWXmY0mx0&l=115&t=OEgsToPDskLP7Nuz7y8KgXbFKIzxVsrF
There was a little more involved then just this, but this gives you the basics.
This workbook contains (see below) all the workings and the checks required, I've tried to keep it simple but also functional in trying to anticipate errors etc. If you have a problem then please let me know. The code is commented and Open as are all my workbooks. Also note there are rightclick options to paste for the addressbar.
Tested on XL2003 (Service pack 2) on Win XP Home Edition (Sevice pack 2)
This page was created 27th August 2007
19th Feb 2008 - Please note.
This workbook DOES NOT work as YouTube have CHANGED the format of there download string. I am currently working on a fix AND a NEW User Interface.