Here is simple bash script to copy FLV Youtube into your folder in Ubuntu 12.04 Precise Pangolin. At this example, I put this script on home folder and create “Youtube” folder :
cd ~/
mkdir Youtube
vim u2tube.sh
chmod a+x u2tube.sh
u2tube.sh
#! /bin/sh
lsof -n -P | grep FlashXX | awk '{ print "/proc/" $2 "/fd/" substr($4, 1, length($4)-1) }' | while read f
do
echo $f
cp $f /home/ubuntu/Youtube/`basename $f`-`date +%H:%s-%d-%m-%y`
done