Skip to main content

How to download Flash Files : No Flash files in /tmp ?

Firstly, we have our facebook page now, you will find a link to like this page in the right column, please like this page and keep yourself updated about new post(s) on Linux on Desktop.


First a disclaimer,it might be illegal to download flash file,it depends upon the website's TOS and I encourage you to go through them before attempting to download flash file, if it is illegal I will NOT recommend that you download flash file.


There are different ways to download flash file, there are plugins that you can install in firefox, there are scripts that allow you to do so, however,one of the better ways that I have used for years( at least more than a year) is copying FlashXXX files from /tmp and renaming them appropriately.

Whenever flash played any media file in the browser, it downloaded Flash file locally in /tmp and deleted it when you closed the page. This had many advantages, for instance if you find something interesting and have already watched it in browser, you do not have to download it again using some plugin, or for instance you could only play part of file by seeking it appropriately and the relevant section is only downloaded in /tmp.

However, I found after updating my system, I no longer had FlashXXX files stored in /tmp , I looked frantically on net to find out reasons for this and found that this has to do with Adobe Flash Player being updated, which no longer saves Files temporarily in /tmp. I further looked up different forums on the Internet and found Flash indeed saved file on the system locally, it was just bit more difficult to access them.

In this post I would try to demonstrate how to retrieve flash files stored locally in the system while it is being played in the web-browser when they are not saved in /tmp. This works with Mozilla Firefox, I haven't tried this with other browsers, though it can work.

One approach to solve this problem would be to downgrade your flash to earlier version, but this is not recommended as updates fix many critical security vulnerabilities and further have performance improvements.

The key to finding flash is the fact that on POSIX based systems, or for instance GNU/Linux all the information about processes running on the system is stored in "/proc" directory were each running process is identified with Process ID and there is a directory corresponding to PID in /proc. Further, all the open File descriptors are maintained here i.e in a lyaman all the information about files opened by process is here.

So if we can find process ID corresponding to the instance of flash player and find the fd corresponding to opened flash file we can easily copy the file and this is the approach that is followed by this script ( I am not the original author of this script) :

Open your favorite text editor and copy the following script, and rename it to something like - findflash.sh

#!/usr/bin/env bash

for flashpid in $(pgrep -f flashplayer.so); do
cd "/proc/$flashpid/fd"
for video in $(file * | grep '/tmp/Flash' | sed 's/\(^[0-9]*\).*/\1/g'); do
echo "/proc/$flashpid/fd/$video"
done
done
Now, open your favorite flash(ensure it is legal to copy) file in web-browser, and in terminal window execute this file by issuing command :

bash findflash.sh
This should print the fd corresponding to all the flash files currently playing, copy them using conventional UNIX command and rename it to meaningful name.

The screen shot below illustrates this -

We had opened a video in Firefox, then we executed findflash.sh script, which gave us file descriptors of opened flash video, we copied and renamed this to some meaningful file name and played it using mplayer.



Article Written by : Ambuj Varshney (blogambuj@gmail.com)
For Linux on Desktop Blog , http://linuxondesktop.blogspot.com
(C) 2011 , Ambuj Varshney

Comments

  1. Thanks for the post. You saved me a lot of time researching the issue. Your method worked for me with Chromium 10.0.648.151 under Arch Linux, using the built-in Flash support.

    One usage note: use the "cp" command in a terminal rather than trying to copy the file with a file manager. Thunar, at least, can't follow the link to make a copy. However, invoking VLC against the link in Thunar worked fine.

    Here's what the link looks like --
    [rms@archbang scripts]$ bash findflash.sh
    /proc/13078/fd/28
    [rms@archbang scripts]$ ls -l /proc/13078/fd/28
    lr-x------ 1 rms users 64 Mar 21 17:47 /proc/13078/fd/28 -> /tmp/FlashXXhqthjL (deleted)
    [fdz@archbang scripts]$

    [No, I,m not rms, but I don't think he would mind!]

    ReplyDelete
  2. @dougz : I am glad you liked this post, I have used cp here in the screen shot. thanks for the tip :D

    ReplyDelete
  3. Thanks for this - I will try it. Here's another way: When I couldn't find the flash files in /tmp anymore, I researched and found that the files can be found in your Firefox cache. This is a bit harder to find, and you have to enable "Show Hidden Files" in the "View" menu. I also had to enlarge the cache size - I changed it to about 1000 mb. Then, if you sort the files in the cache by size, the flash files are usually at the end, because they're the largest. Just copy them, or even cut and paste, to the folder you want to keep them in and rename them to something meaningful.

    ReplyDelete
  4. kunlej3:35 AM

    Great! Debian Squeeze(beta) had the old way /tmp for flash files. However the new Crunchbang (based on debian squeeze stable) is already with new flash player.

    I'd just add to your .sh one line before the 'done':

    cp "/proc/$flashpid/fd/$video" /tmp

    in this way, with a 'single click', all flash instances at a time are copied to /tmp, which I find more flexible to manage afterwards. And you don't need terminal at all for that - just double click on .sh file from let's say desktop.

    Thanks a lot
    Cheers

    ReplyDelete
  5. voltron2:11 PM

    thank you so much! Works perfect, but I sure miss the easy way of just copying straight from the tmp folder.

    ReplyDelete

Post a Comment

Popular posts from this blog

13 Things to do immediately after installing Ubuntu

In this article i describe some of the things to do immediately after installing ubuntu on your machine . Since most of the people reading this would be shifting from Windows to Linux with a system dual booting so i would focus more on making transition easy from Windows to Linux.

Creating Your ultimate Ubuntu 7.10 Desktop

Ubuntu 7.10 Codenamed Gusty Gibbon was released few weeks back with much fanfare ,now Ubuntu for past couple of years has been one of the most popular Desktop Linux distributions . Ubuntu 7.10 includes a number of features , applets and Wizards to simplify desktop Linux experience however because of many licensing restrictions it does not include out of the box support for popular audio/video codecs and many commercial but good applications . Also because of the limitation of trying to accommodate all kind of applications on single CD Ubuntu comes with a limited set of applications .

Now , i often have arguments with my friends who are new to computers that windows is…

Over 16 Small Games For Ubuntu Linux

Over 16 Small Games For Ubuntu Linux

Ubuntu Linux is one of the most popular Linux distribution , it is especially popular among Linux newbies and windows refuges . Now Ubuntu Linux does come with a descent set of applications , still there is a scope for including some more quality applications and especially games . Now in this tutorial i will show you how to install a large number of small , easy and less resource hungry games on Ubuntu Linux with screen-shots of games .


1. Rocks 'n' Diamonds

Rocks 'n' Diamonds is a Boulderd*sh game for X11 with more than just the falling rocks and diamonds of its namesake. The object is still to collect all the diamonds (and emeralds), then get to the exit before time runs out. But your character must make use of bombs, spaceships, and many other elements in order to fill his quota of jewels.

Installation : -

Type the following command in the terminal window

wget http://www.artsoft.org/RELEASES/unix/rocksndiamonds/rocksndiamonds-3.2…

Making Music(Beats) on Linux/Ubuntu with Hydrogen

I am going to review a couple of Music Making Softwares for Linux and am starting with the simplest and one of the best!HYDROGEN. Hydrogen basically is a pattern based drum programming software which in layman terms means, it allows you to make your own beats.And in case you aren't much into music, you might be wondering “what the hell will i do with this piece of software”...well here is a word from my friends who've tried this: “Its pretty fun playing with this software, n even without knowing much, you could actually MAKE SUM MUSIC!!!”

There was this software called Acoustica Beatcraft(for windows) which actually introduced me to this beat making stuff and I was quite interested, but sadly it was too costly for me to buy it. So i was stuck using the trial version of the software and sadly as soon as i got the grip of the software the trial expired, and so my search began for software which would do the stuff for me and luckily i found this amazing piece of software HY…