Sunday, April 1, 2012

Downloading flash videos in ubuntu

Here is a modified version of a online script I found to download videos. Online script download everything which is a clutter because it has many flash ads too.

$ cat ~/Dropbox/new_installation/scripts/flash_vid.sh
#!/bin/bash
num=1;
for FILE in $(lsof -n | grep "Flash.*deleted" | awk '{printf "/proc/" $2 "/fd/"; sub(/[a-z]+/,"",$4); print $4}'); do
cp $FILE $HOME/Desktop/$num.flv
size=$( stat -c %s $HOME/Desktop/$num.flv);
if [ $size -gt 5000000 ]; then
num=$[$num + 1];
else
rm $HOME/Desktop/$num.flv;
fi
done

No comments:

Post a Comment