Running the script
Building the script
Just copy the following script into the Script Editor.app (/Applications/AppleScript/Script Editor.app):
set pageURL to display dialog "Enter the URL of the YouTube video's page:" default answer ""
set AppleScript's text item delimiters to "?v="
set v_id to item 2 of text items of text returned of pageURL
set pageURL to "http://www.youtube.com/v/" & v_id
set locationURL to do shell script "curl -I " & pageURL & " | grep ^Location | grep -o 'video_id=.*'"
set AppleScript's text item delimiters to "&t="
set t_id to item 2 of text items of locationURL
set downloadURL to "http://youtube.com/get_video?video_id=" & v_id & "&t=" & t_id
open location downloadURL
Saving the script
Let's save this AppleScript as an AppleScript application. To do this, just click File > Save. Type in a name for your appliction and choose "Application Bundle" from the "Format" drop-down box.
To run the YouTube downloader, double-click on the AppleScript application that you just created. When the script starts, it will display a dialog asking you for a YouTube URL (this is the URL that you copy from the address bar, not
from the YouTube embed). Paste the URL and click "OK." The application will then start running and run a couple background processes -- in about 1-2 minutes (depending on internet connection / Mac speed) your default browser will begin downloading a file named "get_video.flv."
Once the download has finished, you can convert the flash video into something that you can look at natively. I recommend a free application called iSquint
-- you can drop the flash video onto the iSquint app and convert it into numerous formats including iPod and Apple TV.Additional notes
- This script was designed to work on Mac OS X Tiger / Leopard.
- While this script was designed and tested to work with Safari 3.0 and Firefox, it can be used with other browsers; however, if you are experiencing difficulties with your default browser, try Safari or Firefox