📜 ⬆️ ⬇️

Saving flash-video from browser cache

Imagine, here you are in the browser with a dozen porn videos, they had time to download and suddenly it turned out that the browser needs to be closed. What to do?

You can save all the flv-videos that are currently open in the browser to a separate directory with this simple single-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 run the script again, the old files are not overwritten, but 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 works only when the video flash player is delivered as a flv file using the http protocol.

UPDATE :
Very often in flash-video a quiet sound. In this case, you can use an external player, in which you can make this sound louder (for example, mplayer). By slightly changing the script, you can immediately load the playlist of cached videos into 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

Switch between the rollers in the list can be keys '<' and '>'.

Source: https://habr.com/ru/post/134385/


All Articles