Downloading YouTube videos on the Mac

The advice in Erica Sadun’s two posts from last year on how to download videos from YouTube don’t seem to work anymore. In particular, on my iMac, the video does not get stored in my /tmp directory as Erica’s second post says.

Here’s what works today. I know it works because I just followed these steps to get Prince’s Superbowl halftime show.

  1. In Safari, open the Activity window.
  2. Go to YouTube and start playing the video you want to download.
  3. Bring the Activity window to the front. You should see the name of the YouTube page with a little triangle next to it and a list of the URLs of all the items on that page under it. If the list is hidden, click on the triangle to reveal it. One of those URLs will end with “video\_id=XXXXXXXX,” where the XXXXXXXX part will be some seemingly random string of characters. This is the URL you need to download the video. (If the video is still loading, you’ll see something like “nn of NN MB” in the Status area for that item. This is usually easier to spot than the “video\_id” part of the URL.)
  4. Double-click on that item start downloading. The file will be called “get_video,” and it will be saved wherever your downloads usually go. For many people, that’s the Desktop; for me it’s a Downloads folder in my home directory.
  5. Rename the video after the download is complete, and give it a “.flv” extension.

What you do the video now is up to you. I’ve used iSquint to convert the flv (Flash Video) file into an mp4 (MPEG-4 Video) file that can be played in the QuickTime player or added to my iTunes library.

This procedure is not my own discovery. It’s a combination of Erica’s original posts and the comments (especially Andy Lee’s) to Erica’s second post.

Update
While the procedure described above does work, Erica Sadun has kindly pointed to a more recent post of hers that explains where the Flash Video goes now. It now ends up in /var/tmp/folders.501/TemporaryItems (see caveat 1 below) and is named “FlashTmp0” (or maybe “FlashTmp1” or “FlashTmp2,” etc.; see caveat 2 below). This file will be created when the YouTube video starts loading; it will be ready to be renamed (Step 5 from the procedure above) when the loading is finished.

The advantage of pulling the video file out of the TemporaryItems folder is that the video file will be downloaded only once. If the video file is big—or your connection is slow—this could save you a fair amount of time. And there’s a satisfaction in knowing that you’ve been using bandwidth efficiently. The advantages of double-clicking in the Activity window are:

  1. it’s easier to find the video once it’s downloaded; you can just click on the little magnifying glass icon in Safari’s Downloads window.
  2. the video files won’t overwrite each other the way “FlashTmp0” will (see caveat 2 below).
  3. it should continue to work the next time Apple changes where temporary items are saved.

Right now, I’m not sure which I prefer.

Caveat 1 The name of the folder where you’ll find the video file depends on your user ID number. For most people, working on single-user Macs, this ID will be 501, and the folder name will be what I said above. If you have more than one user account set up on your Mac, your user ID number may be 502, 503, etc., and you’ll need to adjust the name of the folder accordingly. You can find your user ID number by executing the id command from the command line.

Caveat 2 The number of video files in the TemporaryItems folder and the names of those files depend on how many windows or tabs you have open that contain YouTube videos. If you have only one window or tab with a YouTube video, you can be assured that it will be called “FlashTmp0.” Be careful of this! If you start loading another video in that same tab or window, the new video will be saved with the same name, overwriting the old one.

Tags: