Download de vídeos do YouTube em buffer no Ubuntu usando o terminal

O problema
Muitas vezes assistimos a um vídeo no YouTube e queremos salvá-lo.
Para isso, temos que baixá-lo novamente na maioria das vezes. Tudo bem para vídeos pequenos, mas se o tamanho do vídeo for grande, baixar novamente com a ajuda de qualquer auxiliar de download ou algo parecido consumirá novamente sua largura de banda e resultará na duplicação de seus downloads.

Solução
Encontrou um método independente de navegador em fóruns do Ubuntu para salvar vídeos do YouTube armazenados em buffer no Ubuntu via terminal.

Etapa 1 : Encontre o pid do flashplayer:


pgrep -f flashplayer
</pre></code>

Let the result you get be xxxx.

Step 2 : Navigate through RAM :

cd /proc/xxxx/fd
ls -l
</pre></code>

Step 3 : Note down the number associated with '/tmp/FlashXXXXXX (deleted)

Ex : 16 or 24 or whatever... (There can be more than one ... all of them are videos)

Step 4 : copy video to another location

cp <the_number> <location_where_you_want_to_save>
Ex : cp 16 /home/username/10.flv


Make sure to write your own username and save file with .flv extension.

Kudos, Its Done!

The concept behind this being that the buffered videos are saved in RAM for a while and you can retrieve them from there itself rather than downloading again.
There are certain applications those download the videos on one click as they are being played but this results in the duplication, one for streaming & one your download file.

You can also use flashgot addon in Mozilla for the same purpose.

Or to simplify the process, there is a python script StreamingVideoDownloader http://goo.gl/1aTi8Y

Or youtube-dl is also a nice alternative. http://goo.gl/l0wYW

Note
It works well when you've buffered it already and haven't closed that tab/window.
The above method works in Ubuntu because you can browse the RAM in Linux & not in windows.
People further interested can browse for other methods (like retrieving it from browser's cache via GUI.