10.5: How to save YouTube videos from cache

Oct 07, '08 07:30:02AM

Contributed by: stottm

This previous hint explained how to download Flash videos in Safari via the Activity Viewer. This still works in Leopard -- most of the time. However, I had trouble with a large video one day, and found it was stored in the Google video cache. The download would stall and timeout (pausing the Safari download and restarting it caused Safari to restart the download from the beginning -- I suspect it was meant to be streamed only.) The download would work fine in the YouTube Flash player, and it would even cache fully within the web page.

YouTube uses Adobe Flash file format *.flv files. Adobe FLV files used by the YouTube flash player are not stored in the Leopard 10.5 Safari cache. Even if they were, they would be stored inside a SQLite database file, which is not very useful. (If you are looking for other Safari Cache tools, there's a variety of tools to read the SQLite DB and retreive images and html from the database -- Google and ye shall find.) After some digging, I found that my video file was stored here:

/var » folders » V4 » V46lRYwnH3uc8gj98CH+t++++TQ » TemporaryItems » FlashTmp0

The middle part is randomly generated, and will certainly vary for everyone. I believe the first entry in /var/folders/ will always be in capital letters. Read on to see how I saved the movie...

View the YouTube video as normal, pause it, and let it cache fully on the web page. Open Finder and click Go » Go to Folder and enter /var/folders; this will get you to the hidden folders. Drill down the various folders you see there until you find one that has a TemporaryItems folder within it. Open that folder, and then look for files named FlashTmp (they will end in a number). Figure out which file you want -- there will only be one if you only have one YouTube page up.

Now make a copy of the file by Option-dragging it to your Desktop. Rename this copy to end in .flv, and run it through whatever converter you wish to use. Reminder, make sure the movie is fully cached in the YouTube flash player first, or you will end up with an incomplete file.

I use VisualHub as my converter, but unfortunately, the developer has decided to shut down his Techspansion company, and this shareware is currently unavailable except to existing customers. (He is thinking about open sourcing it, but he hasn't made up his mind yet.) VisualHub uses the open source ffmpeg library for all the heavy lifting and actual work -- that makes VisualHub a frontend to ffmpeg. You can download, compile, and use an ffmpeg command line tool, or you can try another shareware front-end for OS X called ffmpegX; there are other commercial tools that can convert flv files as well.

[robg adds: The new location for Leopard users is noted in the comments to this hint, but I felt it worth noting as a standalone hint.]

Comments (24)

Mac OS X Hints