An interesting side-effect of YouTube's recent push for higher quality videos is that most videos can be downloaded as MP4 files directly from YouTube. Until now, you could only get FLV files from your browser's cache or using one of the many websites that let you download YouTube videos. In fact, to download the MP4 files, you need to use the same URL like for FLV files and append "&fmt=18":
ID is the video's identification value, SIGNATURE is a value that prevents you from downloading the file just by knowing the ID. You could create this URL by looking at the source code of a YouTube page, but it's much easier to automatically generate it.
One way is to save the following link as a bookmarklet by dragging it to your Links bar (in Firefox, Safari) or right-clicking and adding it to your favorites (in Internet Explorer, Opera):
If you didn't manage to add the bookmarklet, this post has more detailed instructions.
When you want to download a YouTube video, just click on the bookmarklet.
After clicking on the download link, YouTube will try to save the video as "video.mp4". You should enter a more appropriate name if you want to find the video later.
YouTube's MP4 files have a higher resolution, stereo sound and can be played with applications like VLC, MPlayer, iTunes, QuickTime. Not all YouTube videos can be downloaded as MP4 files and the fallback format is FLV.
Update: You no longer have to right-click and select "save link as" because YouTube sends the right MIME type. Just click on the download link.
Update 2: If the video is available in HD, the bookmarklet and the script download the HD version. Thanks, pepemosca!