9

I know that in Windows, Internet Explorer stores .flv temp files in temporary folder (C:\Users\%username%\AppData\Local\Microsoft\Windows\Temporary Internet Files) when viewing YouTube. And the same make and Google Chrome in Windows (C:\Users\%username%\AppData\Local\Google\Chrome\User Data\Default\Cache). So it's easy to find a copy of that .flv file.

How about Chromium in Ubuntu? Does it store browsing temp data and where?

3
  • 1
    If you just want to have a copy of some youtube videos, I'd suggest using youtube-dl command line program to fetch the best quality video available. In short, sudo apt install youtube-dl and later cd ~/Videos && youtube-dl "https://youtu.be/ESUCEaOUx_M". Commented Apr 13, 2019 at 8:13
  • @MikkoRantalainen this script will nto work for write protected video. downloading from the cache or from the any browser plugin is the only way
    – softy
    Commented May 17 at 3:38
  • What do you mean with "write protected video"? Can you give an example URL for such a video? Commented May 17 at 7:24

6 Answers 6

16

I made a little research and now I can come with the answer that is not so simple as it seems at first sight.

I searched a lot on Google, and almost everything is pointing to the ~/.cache/chromium/Default folder. It’s the folder where you should find google chrome’s cache files. But there are no big flash video files (like YouTube has), just small ones.

In the end, to answer the question, I came to these conclusions:

  • First, you have to open an YouTube video and let it stream from internet.
  • In a Terminal (Ctrl+Alt+T), you should get PID of Chromium that use Flash Player plugin. You can use various commands, but ps will do just fine: ps ax | grep flash.
  • Once you have this PID you can find out the name of video file that just was streamed on Youtube: ls -l /proc/[*PID*]/fd | grep Flash. You will see as result something like this:

    lrwx------ 1 [*user*] [*user*] 64 mai 2 09:48 [*video file name - is a number*] -> /tmp/FlashXX4PeKRY (deleted)`
    

    And here is the answer of the question: the last video file streamed on YouTube and cached on the system is:

    /proc/[*PID*]/fd/[*video file name - is a number*]
    
  • Now, if you want, you should copy them anywhere on the system:

    cp /proc/[*PID*]/fd/[*video file name - is a number*] ~/Videos/[*new video file name*].flv
    

    And now you have the last video watched on Youtube in your personal Videos collection.

enter image description here

1
  • the pid keeps changing while the video is being buffererd. I saw different pids while the video was running on typing this command : ps ax | grep flash
    – softy
    Commented May 17 at 3:43
11

I wrote a small bash script that automates the excellent solution from Radu:

#!/bin/bash

pidNum=$(ps ax | grep flash | grep chromium | grep -v "grep" | sed -e 's/^ *//g' -e 's/ *$//g' | tr -s " " | cut -d " " -f 1)
procNum=$(ls -l /proc/${pidNum}/fd | grep Flash | tr -s " " | cut -d " " -f 9)

filename=$1
if [[ "$filename" == "" ]]; then
    filename=$procNum
fi

echo "Copying /proc/${pidNum}/fd/${procNum} to '${filename}.flv'"
cp /proc/${pidNum}/fd/${procNum} "${filename}.flv"
ls -lah "${filename}.flv"
1
  • 1
    I'm affraid it doesn't work with newer versions of Chrome and Chromium (Chromium 40.0.2214.111 Ubuntu 14.04). Any idea why?
    – Leszek
    Commented Feb 19, 2015 at 10:27
1

I do it manually like this: define this alias in /etc/bash.bashrc

alias findflash='find /proc/ -maxdepth 1 -type d -exec lsfd.sh {} \;'

and create this script in /usr/local/bin/lsfd.sh

#!/bin/bash
ls -l $1/fd/ 2>/dev/null 3>/dev/null| grep -i 'flash' 1>/dev/null  2>/dev/null 3>/dev/null;
if [ $? -eq "0" ]; 
then 
echo $1/fd/;
ls -l $1/fd/ | grep -i 'flash';
fi

result:

root@juanmf-V570:/tmp# findflash 
/proc/31591/fd/
lrwx------ 1 root root 64 Aug 19 23:59 37 -> /home/juanmf/.config/google-chrome/Default/Pepper Data/Shockwave Flash/.com.google.Chrome.9Oc0fE (deleted)
lrwx------ 1 root root 64 Aug 19 23:59 38 -> /home/juanmf/.config/google-chrome/Default/Pepper Data/Shockwave Flash/.com.google.Chrome.hcEvxv (deleted)

then I know where the files are and use mplayer to see wich one I want. then manually copy.

0

Chromium keeps its cache files in various folders which might change from time (depending on the version?). So you should perhaps browse all of them to find what you are looking for.

And they are:

  • /home/$USER/Media Cache
  • /home/$USER/.cache/chromium/Default/Cache
  • /home/$USER/.cache/chromium/Default/Media Cache
  • /home/$USER/.config/chromium/Default/Cache
  • /home/$USER/.config/chromium/Default/Media Cache

The youtube files you are interested in are mostly likely to be under one of the Media Cache folders, but without any file extension. Luckily, unlike Windows, Linux often detects file types irrespective of the extension. So you might recognize them with video file icons or even thumbnails.

1
  • In these folders are no big flash video files, just small ones. Commented May 1, 2013 at 21:52
0

I wrote new bash script for download flash video files using ubuntu 16.04 and chromium Version 62. thanks to this example from mcbarron

Also you can view on github repository

#!/bin/bash
echo "Crawling for flash files."
getPidNum=$(lsof | grep Flash | grep deleted | tr -s " " | cut -d " " -f 2)
pidNum=""
for linePidNum in ${getPidNum}; do
    if [[ "$pidNum" != "$linePidNum" ]]; then
        pidNum=$linePidNum
        echo "PID Number Is ${pidNum}"
        getProcNum=$(ls -l /proc/${pidNum}/fd | grep Flash | tr -s " " | cut -d " " -f 9)
        procNum=""
        for lineProcNum in ${getProcNum}; do
            if [[ "$procNum" != "$lineProcNum" ]]; then
                procNum=$lineProcNum
                echo "File Number Is ${procNum}"
                echo "Copying /proc/${pidNum}/fd/${procNum} to '${procNum}.flv'"
                cp /proc/${pidNum}/fd/${procNum} "${procNum}.flv"
            fi
        done
    fi
done
-2

Chromium throws files into .cache/chromium/Default under theCache and Media Cache folders.

4
  • Hi, when you post something you can take advantage of the formatting facilities that appear just above the text box when your drafting your answer. This is basic markdown stuff. You can look at some edited questions and answers to see how it's done.
    – user25656
    Commented May 1, 2013 at 12:41
  • I searched there, but nothing about by video files from You Tube (or others). So, not the right answer... yet. Commented May 1, 2013 at 12:49
  • @vasa1 -> Hey how about you not edit my posts? That'd be great. I'm well aware how to use markdown. Radu -> It's not going to blatantly give you the .flv file, you'll need to pretty much convert all the files to .flv to figure out which one is a video. It's really just best to use something like KeepVid. In terms of "not the right answer", sorry to disappoint you but it is. That is where Chromium and Chrome save all their cached files.
    – JoshStrobl
    Commented May 2, 2013 at 12:43
  • @JoshStrobl, sorry about that!
    – user25656
    Commented May 2, 2013 at 12:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .