Try this script:
#!/bin/sh
IFS='\
'
for i in `ls -dLtr \`lsof -c plugin-containe -a -u $USER -X +L1 | awk -F ' +' '/\/tmp\/Flash/{ print "/proc/" $2 "/fd/" gensub("[^0-9]", "", "g", $4); }'\``; do
PLAY="$PLAY $i"
done
IFS=' '
mplayer -osdlevel 3 -fs $PLAY
I have it bound to a shortcut key in my window manager and I installed http://userscripts.org/scripts/show/13333 to automatically pick 720p videos, and pause them.So I go to youtube in a tab, let it buffer for a bit, hit the shortcut key and enjoy.
Note that it's only semi-recent versions of flash that automatically delete the videos, if not remove the +L1
Just tried it. Consider my mind blown.
If you get an error relating to gensub ("function gensub never defined"), you need to install gawk.
For most Flash video hosting sites, clive¹ is the easiest way to download a video to watch in an external player; sometimes I've had to resort to poking through the HTML source in Firebug, but even that doesn't always yield a useful result. I'll have to keep lsof in mind the next time I hit one of those!
Re:An lsof Primer
by mixmastamyk on Monday October 10, 2011 @02:40PM
(#3095158)
Thanks. I also appreciate watching long presentations in an app such as VLC because I can then watch it at 1.2x or 1.5x speed to save time. After getting used to it a normal speed presentation seems to plod on forever.
Back in the day (Flash 9 or so?) the flash player used to just dump temporary flash video files in /tmp and delete them after you close the browser tab. I guess they figured it was too easy to copy the files out of /tmp so the newer flash player deletes the /tmp file immediately after it creates them. This is why we have to go and grab the open file descriptor.
This will work with most but not all websites. Some websites (Hulu) will use a streaming protocol (rtsp) among other things to make the content harder to get at outside of flash.
This works on Linux, I'm not sure about OSX or BSD.