Save cached video on firefox?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












1















I found a script on the internet that allows me to save cached flash files.



https://github.com/janosgyerik/shellscripts/blob/master/bash/save-flash-linux.sh



This would allow me to run the command saveflash in a terminal to list flash videos and filesizes. And then I could run something like saveflash -n 2 nameofvideo.mp4 to save it. I even added the capability to demux the audio out of the video.



I'm trying to do the same for non-flash videos that are cached by firefox. I would like a command, or set of commands that I can run to list the video files and then save them.



It's a little more convoluted. I have to use lsof to list open files, find ones that have a suitable filesize and then get the proc and fd to use for the copy command.



Right now, I do it manually, running a command like this:



lsof -c firefox | grep -i deleted


The lsof command takes a few seconds to complete. And then I have to manually put together the copy command based on what the lsof command says that the pid and fd of the file is, then I would do a command like:



cp /proc/3164/fd/55 "~/Videos/Name of Video.mp4"


What's the best way to speed up/simplify this process? I'd like to make it into a script eventually.










share|improve this question




























    1















    I found a script on the internet that allows me to save cached flash files.



    https://github.com/janosgyerik/shellscripts/blob/master/bash/save-flash-linux.sh



    This would allow me to run the command saveflash in a terminal to list flash videos and filesizes. And then I could run something like saveflash -n 2 nameofvideo.mp4 to save it. I even added the capability to demux the audio out of the video.



    I'm trying to do the same for non-flash videos that are cached by firefox. I would like a command, or set of commands that I can run to list the video files and then save them.



    It's a little more convoluted. I have to use lsof to list open files, find ones that have a suitable filesize and then get the proc and fd to use for the copy command.



    Right now, I do it manually, running a command like this:



    lsof -c firefox | grep -i deleted


    The lsof command takes a few seconds to complete. And then I have to manually put together the copy command based on what the lsof command says that the pid and fd of the file is, then I would do a command like:



    cp /proc/3164/fd/55 "~/Videos/Name of Video.mp4"


    What's the best way to speed up/simplify this process? I'd like to make it into a script eventually.










    share|improve this question


























      1












      1








      1








      I found a script on the internet that allows me to save cached flash files.



      https://github.com/janosgyerik/shellscripts/blob/master/bash/save-flash-linux.sh



      This would allow me to run the command saveflash in a terminal to list flash videos and filesizes. And then I could run something like saveflash -n 2 nameofvideo.mp4 to save it. I even added the capability to demux the audio out of the video.



      I'm trying to do the same for non-flash videos that are cached by firefox. I would like a command, or set of commands that I can run to list the video files and then save them.



      It's a little more convoluted. I have to use lsof to list open files, find ones that have a suitable filesize and then get the proc and fd to use for the copy command.



      Right now, I do it manually, running a command like this:



      lsof -c firefox | grep -i deleted


      The lsof command takes a few seconds to complete. And then I have to manually put together the copy command based on what the lsof command says that the pid and fd of the file is, then I would do a command like:



      cp /proc/3164/fd/55 "~/Videos/Name of Video.mp4"


      What's the best way to speed up/simplify this process? I'd like to make it into a script eventually.










      share|improve this question
















      I found a script on the internet that allows me to save cached flash files.



      https://github.com/janosgyerik/shellscripts/blob/master/bash/save-flash-linux.sh



      This would allow me to run the command saveflash in a terminal to list flash videos and filesizes. And then I could run something like saveflash -n 2 nameofvideo.mp4 to save it. I even added the capability to demux the audio out of the video.



      I'm trying to do the same for non-flash videos that are cached by firefox. I would like a command, or set of commands that I can run to list the video files and then save them.



      It's a little more convoluted. I have to use lsof to list open files, find ones that have a suitable filesize and then get the proc and fd to use for the copy command.



      Right now, I do it manually, running a command like this:



      lsof -c firefox | grep -i deleted


      The lsof command takes a few seconds to complete. And then I have to manually put together the copy command based on what the lsof command says that the pid and fd of the file is, then I would do a command like:



      cp /proc/3164/fd/55 "~/Videos/Name of Video.mp4"


      What's the best way to speed up/simplify this process? I'd like to make it into a script eventually.







      linux bash shell-script command-line scripting






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 13 '17 at 23:27







      David Bobb

















      asked Mar 13 '17 at 2:57









      David BobbDavid Bobb

      65




      65




















          1 Answer
          1






          active

          oldest

          votes


















          0














          When you take a look at the mentioned bash script you find the following commands beeing used:



          awk, cut, cp, ffmpeg, file, ls, sed, test, wc



          You should figure out what they do to automate your manual processing with bash.



          Alternative and possible faster ways of getting the pids of firefox is to use pgrep firefox or pidof firefox which may take less time than lsof -c firefox.



          Sometimes it's not neccessary to reinvent the wheel. Tools like youtube-dl (based on python) are available to download videos from many video plattforms.






          share|improve this answer























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f351049%2fsave-cached-video-on-firefox%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            When you take a look at the mentioned bash script you find the following commands beeing used:



            awk, cut, cp, ffmpeg, file, ls, sed, test, wc



            You should figure out what they do to automate your manual processing with bash.



            Alternative and possible faster ways of getting the pids of firefox is to use pgrep firefox or pidof firefox which may take less time than lsof -c firefox.



            Sometimes it's not neccessary to reinvent the wheel. Tools like youtube-dl (based on python) are available to download videos from many video plattforms.






            share|improve this answer



























              0














              When you take a look at the mentioned bash script you find the following commands beeing used:



              awk, cut, cp, ffmpeg, file, ls, sed, test, wc



              You should figure out what they do to automate your manual processing with bash.



              Alternative and possible faster ways of getting the pids of firefox is to use pgrep firefox or pidof firefox which may take less time than lsof -c firefox.



              Sometimes it's not neccessary to reinvent the wheel. Tools like youtube-dl (based on python) are available to download videos from many video plattforms.






              share|improve this answer

























                0












                0








                0







                When you take a look at the mentioned bash script you find the following commands beeing used:



                awk, cut, cp, ffmpeg, file, ls, sed, test, wc



                You should figure out what they do to automate your manual processing with bash.



                Alternative and possible faster ways of getting the pids of firefox is to use pgrep firefox or pidof firefox which may take less time than lsof -c firefox.



                Sometimes it's not neccessary to reinvent the wheel. Tools like youtube-dl (based on python) are available to download videos from many video plattforms.






                share|improve this answer













                When you take a look at the mentioned bash script you find the following commands beeing used:



                awk, cut, cp, ffmpeg, file, ls, sed, test, wc



                You should figure out what they do to automate your manual processing with bash.



                Alternative and possible faster ways of getting the pids of firefox is to use pgrep firefox or pidof firefox which may take less time than lsof -c firefox.



                Sometimes it's not neccessary to reinvent the wheel. Tools like youtube-dl (based on python) are available to download videos from many video plattforms.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 13 '17 at 10:26









                Michael D.Michael D.

                1,707917




                1,707917



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f351049%2fsave-cached-video-on-firefox%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown






                    Popular posts from this blog

                    Peggy Mitchell

                    Palaiologos

                    The Forum (Inglewood, California)