Saving flash-video from browser cache

Published on December 11, 2011

Saving flash-video from browser cache

    Imagine, you opened a dozen porn videos in a browser , in the meantime they downloaded and suddenly it turned out that the browser needs to be closed. What to do?

    You can save all currently open flv-videos in a browser into a separate directory with such a simple one-line script.

    copy-cached-flv.sh


    #! / bin / bash
     
    lsof  -n  + L1  |  grep  / tmp / Flash  | \
        awk  '{line = "/ proc /" $ 2 "/ fd /" $ 4; sub ("[^ 0-9] * $", "", line); print line} '  | \
        xargs  -I  '{}'  cp  -v  '{}'  -t  "$ @"  --backup = t



    Using


    ./copy-cached-flv.sh “destination directory”

    $ ./copy-cached-flv.sh ~ / my_flash_videos /
    `/ proc / 24624 / fd / 29 '->` / home / giner / my_flash_videos / 29'
    `/ proc / 24624 / fd / 35 '->` / home / giner / my_flash_videos / 35'


    When you re-run the script, the old files are not overwritten, but are renamed.

    $ ./copy-cached-flv.sh ~ / my_flash_videos /
    `/ proc / 24624 / fd / 29 '->` / home / giner / my_flash_videos / 29' (backup: `/home/giner/my_flash_videos/29.~1~ ')
    `/ proc / 24624 / fd / 35 '->` / home / giner / my_flash_videos / 35' (backup: `/home/giner/my_flash_videos/35.~1~ ')


    Important: note that this method only works if the video to the flash player is delivered as a flv file using the http protocol.

    UPDATE :
    Very often in a flash video a quiet sound. In this case, you can use an external player, in which it is possible to make this sound louder (for example mplayer). By changing the script a bit, you can immediately download the playlist of cached videos to the player.

    mplayer-play-cached-flash.sh


    #! / bin / bash
     
    lsof  -n  + L1  |  grep  / tmp / Flash  | \
        awk  '{line = "/ proc /" $ 2 "/ fd /" $ 4; sub ("[^ 0-9] * $", "", line); print line} '  | \
        Xargs  mplayer  -softvol-max  1000

    You can switch between clips in the list using the keys '<' and '>'.