I don't know of any programs, but you don't really need a program to do this.
Youtube videos (and other Flash videos) store the content in your /tmp directory while the video is open.
Once you close the window, the temporary file will be gone, but there will be a temporary file in /tmp of the form FlashRANDOMCHARS for every open video.
Example (after opening some video on youtube):
zmk@thinkpad:~$ ls /tmp
zmk@thinkpad:~$ file /tmp/Flash5B1VH7
/tmp/Flash5B1VH7: Macromedia Flash Video
Just copy the file somewhere other than /tmp once the video is fully downloaded.
mplayer is capable of playing this type of video, and mencoder (included with mplayer) is capable of converting it.
Be aware that while I don't believe that it is illegal to download such videos for later viewing, it may be illegal to redistribute them to others.