PaulSadowski.com 

PaulSadowski.com
How To Save A Google Video To Your Hard Disk
How To Save A Google Video To Your Hard Disk

If you use Google Video to view videos and want to save the video to your own machine, here's one way to do it. These are Flash files. You will need a player such as this free player at http://www.snapfiles.com/get/flvplayer.html

There are three versions of this script.
Version 1 uses a popup box to display the real decoded URL of the video file.
Version 2 copies the real decoded URL to the clipboard
Version 3 downloads the video file to your disk.

Version 1
Here's how you use it. Find a video on Google Videos and copy the URL to your clipboard. Start the script by clicking on it in explorer or from a shortcut on your desktop.

You will be prompted for the URL of the video you just copied.

Paste the copied URL into the input box and click OK.
Wait a minute while the page is loaded and the video location determined.

A popup box will appear next that contains the decoded URL of the video's location. Press Control-C to copy this information to your clipboard. Paste it into Notepad or another text editor.

It will look something like this:
---------------------------
Google Video URL Decoder Result - Control-C to copy; Paste to notepad
---------------------------
The decoded video URL is
http://vp.video.google.com/videoplayback?id=42650a42b221fbb2&begin=0&len=29100&itag=5&urlcreated=1134288398&docid=173533628817518175
&urlcreated=1134288398&sigh=wA-e0iK392mooU2iZq6sFo7Zz0A&autoPlay=true
---------------------------
OK
---------------------------

Copy the line beginning with http:// to your clipboard and paste it into IE's addressbar.

When prompted by IE, save the file to disk using an extension of .FLV

That's all there is to it.

Please note: I threw this script together just now. While I have tested it, it does not contain much error checking.
 

' GetGoogleVideoURL.vbs
' 11 December 2005
 
Const READYSTATE_COMPLETE = 4
 
URL = InputBox("Enter the URL for the Google video...")
if URL = "" then
  WScript.Echo "No URL entered."
  WScript.Quit
end if
 
Set IE = CreateObject("INTERNETEXPLORER.APPLICATION")
IE.Navigate URL
IE.Visible = true
WaitForIt(60)
 
Set TheVideo = IE.document.getelementbyid("VideoPlayback")
VideoURL = Replace(TheVideo.src, "/googleplayer.swf?videoUrl=", "")
WScript.Sleep 100
IE.Quit
 
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Popup "The decoded video URL is " & vbCRLF _
& Unescape(VideoURL), 360, _
"Google Video URL Decoder Result - Control-C to copy; Paste to notepad", 0
 
Set WshShell = Nothing
set IE = Nothing
 
Function WaitForIt(SleepCount)
Dim idx
WaitForIt = False
Do While IE.Busy Or IE.readyState <> READYSTATE_COMPLETE
'Sanity check
    wscript.sleep 1000
    idx = idx + 1
    if idx > SleepCount then
     WaitForIt = True
     exit do
    end if
Loop
idx = 0
End Function

 

 

Version 2
Here's a variation that copies the URL directly to the clipboard. Be advised this may or may not work depending on your OS version and Service Pack version and your current security settings. It appears to work on XP SP2.
 

' GetGoogleVideoURL.vbs
' 11 December 2005
 
Const READYSTATE_COMPLETE = 4
 
URL = InputBox("Enter the URL for the Google video...")
if URL = "" then
  WScript.Echo "No URL entered."
  WScript.Quit
end if
 
Set IE = CreateObject("INTERNETEXPLORER.APPLICATION")
IE.Navigate URL
IE.Visible = true
WaitForIt(60)
 
Set TheVideo = IE.document.getelementbyid("VideoPlayback")
VideoURL = Replace(TheVideo.src, "/googleplayer.swf?videoUrl=", "")
IE.document.parentwindow.clipboardData.SetData "text", Unescape(VideoURL)
WScript.Sleep 100
IE.Quit
set IE = Nothing
 
Function WaitForIt(SleepCount)
Dim idx
WaitForIt = False
Do While IE.Busy Or IE.readyState <> READYSTATE_COMPLETE
'Sanity check
    wscript.sleep 1000
    idx = idx + 1
    if idx > SleepCount then
     WaitForIt = True
     exit do
    end if
Loop
idx = 0
End Function

 

 

Version 3
The version below gets the decoded URL then downloads the video file. After decoding the URL an Internet Explorer download dialog box will open. You should change the file type to all (*.*) and save with the name you like. You should give it a .FLV file extension.

' GetGoogleVideoURL.vbs
' 11 December 2005

Const READYSTATE_COMPLETE = 4
Dim IE, idx

URL = InputBox("Enter the URL for the Google video...")
if URL = "" then
  WScript.Echo "No URL entered."
  WScript.Quit
end if

Set IE = CreateObject("INTERNETEXPLORER.APPLICATION")
IE.Navigate URL
IE.Visible = true
Do While IE.Busy Or IE.readyState <> READYSTATE_COMPLETE
'Sanity check
  wscript.sleep 1000
  idx = idx + 1
  if idx > 60 then
    exit do
  end if
Loop
idx = 0

Set TheVideo = IE.document.getelementbyid("VideoPlayback")
VideoURL = Replace(TheVideo.src, "/googleplayer.swf?videoUrl=", "")
WScript.Sleep 100

IE.Navigate Unescape(VideoURL)
Do While IE.Busy Or IE.readyState <> READYSTATE_COMPLETE
'Sanity check
  wscript.sleep 1000
  idx = idx + 1
  if idx > 60 then
    exit do
  end if
Loop
idx = 0
WScript.Sleep 1000
IE.Quit
set IE = Nothing
 


 

© 2004,2005 by Paul R. Sadowski 
All Rights Reserved. Used By Permission.
Comments to: scripting