Downloading flash videos to /tmp folder in Ubuntu 10.02 and above

With Ubuntu versions prior to 10.02, video files we watched on our browsers by using the flash plugin could easily be found in the /tmp/ folder. Giving the found file a human name and moving it to our home folder would make it all the way to enjoying those videos offline. But after the Flash Player plugin update to version 10.02 on Ubuntu 10.10 flash videos no longer appear in /tmp.

The story has changed, those of us who were used to download Flash videos, by looking for them in the mentioned directory and then copy the files to some other folder without any additional software, we’ve found that the technique no longer works because the files are no longer stored in that directory.

Note: Successfully Tested with Firefox and Chromium in: Ubuntu 10.10 amd64 (64bit) with 64bit flashplugin, Ubuntu 10.10 amd64 (64bit) with 32bit flashplugin, Ubuntu 10.10 i386 (32bit), Debian Squeeze (stable) and Debian Wheezy (testing), Ubuntu 11.04 and 11.10 (32bit and 64bit). Also tested in Ubuntu 12.04 (32bit and 64bit).

 

EXPLANATION OF HOW DID WE FOUND OUT

 

1. We started playing any Youtube video.

2. Knowing that temporary files are stored under the name of “Flash” + a code of numbers and letters, we opened a terminal and looked for any Flash file with the command “lsof

lsof |grep Flash

 

The terminal showed the following (takes a bit, be patient):

npviewer. 2235     usuario   11u      REG                8,3  6923916     654482 /tmp/FlashXXUt9wzs (deleted)

 

So we realized that the file is “deleted” even before it is completely played.

Note: Ubuntu 12.04 does not show the video file, only the library “/usr/lib/flashplugin-installer/libflashplayer.so”. See solution at the end.

 

2. We run the command again before full reproduction to see if there are any changes:

lsof | grep Flash

 

And the terminal shows:

npviewer. 2235     usuario   11u      REG                8,3 20948620     654482 /tmp/FlashXXUt9wzs (deleted)

 

That way we confirm the file size has increased considerably (from 6923916 to 20948620), so that the file, even if being shown as “deleted”, it is there and is being modified. There must be a symbolic link that lets us get to it.

 

3. We run a search for the link in the /proc/ folder, which is where virtualization files are saved in Linux, with:

ls-l /proc/2235/fd/11

 

2235” is the number of process in the 2nd column.

11” is the file descriptor without the letter that follows in the 4th column.

The command outputs the following:

lrwx------ 1 usuario usuario 64 2011-02-13 18:07 /proc/2235/fd/11 -> /tmp/FlashXXUt9wzs (deleted)

 

Meaning there is a link to the file ( even if it is shown as “deleted”), so all what’s left is copy the that file.

 

4. I copy it to the home directory with the command:

cp /proc/2235/fd/11 video.flv

“video.flv” is the name we give to this video.

We open the personal folder and there is the video and we reproduce it without problems.

 

SIMPLIFIED METHOD

 

Of course you do not have to do everything we’ve done and would be just suffice to:

 

1. Start playing the video, and before it finishes loading completely, locate the file to determine the number and descriptor of the process with:

lsof |grep Flash

 

The terminal will show something like:

plugin-co 2925   kaos1204  DEL       REG                8,6          2232428 /usr/lib/flashplugin-installer/libflashplayer.so

 

We no longer see the temporary file of the video, only the library at “/usr/lib/flashplugin-installer/libflashplayer.so”. To solve this, right click on the video and select “Pop out”.  After opening the new window and before it finishes loading run the command “lsof | grep Flash” and that will show, first of all, the library name and secondly, the temporary file, which is what we care about:

plugin-co 2925   kaos1204  DEL       REG                8,6          2232428 /usr/lib/flashplugin-installer/libflashplayer.so
plugin-co 2925   kaos1204   42u      REG                8,6  1746126  141520 /tmp/FlashXXSccA9R (deleted)

 

2. When the video is finished loading, without closing the browser window, copy the file  to your home directory with the command:

cp / proc/2925/fd/42 video.flv

You must replace 2925 and 42 with the values you obtained with the previous command.

We can then start downloading videos without having to install anything.


Blogsphere: TechnoratiFeedsterBloglines
Bookmark: Del.icio.usSpurlFurlSimpyBlinkDigg
RSS feed for comments on this post
 |  TrackBack URI for this post


Leave a Reply