Firefox - reading out urls of opened tabs from the command-lineReading from STDIN and using data immediatly...

How can I offer a test ride while selling a bike?

Orientable with respect to complex cobordism?

Singlequote and backslash

Order by does not work as I expect

A word used to describe a fish trying to eat bait bit by bit

Can an old DSLR be upgraded to match modern smartphone image quality

If a problem only occurs randomly once in every N times on average, how many tests do I have to perform to be certain that it's now fixed?

Applicants clearly not having the skills they advertise

If a massive object like Jupiter flew past the Earth how close would it need to come to pull people off of the surface?

Could a guilty Boris Johnson be used to cancel Brexit?

The qvolume of an integer

Is there any Biblical Basis for 400 years of silence between Old and New Testament?

Bringing Food from Hometown for Out-of-Town Interview?

Parsing CSV with AWK to Produce HTML Output

Strange math syntax in old basic listing

How does increase in volume change the speed of reaction in production of NO2?

Joist hangers to use for rough cut 2x8 (2 3/4" x 8 3/4")?

Is there a rule that prohibits us from using 2 possessives in a row?

Why does my electric oven present the option of 40A and 50A breakers?

What is the difference between a game ban and a VAC ban in Steam?

Why don't I have ground wiring on any of my outlets?

Could IPv6 make NAT / port numbers redundant?

How to properly maintain eye contact with people that have distinctive facial features?

How was Apollo supposed to rendezvous in the case of a lunar abort?



Firefox - reading out urls of opened tabs from the command-line


Reading from STDIN and using data immediatly (while still reading) or opening a URL with zbarCommand-line file reader (like “less”) that can tell the line where the user stopped readingRemoving blank spaces and tabs from line without messing with line endingsWhere does firefox get the “default” applications for opening files from?opening multiple tabs in firefox using a one-liner bash scriptmkfifo pipes, file descriptors and ImageMagick (convert)Output URL of open tabs in python 3.6.1 (windows)Firefox '3 bar' menu not openingDecompress firefox 57+ opened tabs file on Linux from the command line : Error 44 : Unrecognized header : file cannot be decoded






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







6















I sometimes have quite a big range of tabs open in Firefox and I prefer it to save them to a file, rather then using the build-in bookmarks.



Therefore I (manually) copy the urls from the about:preferences page, save them to a file and process the file with: tr '|' 'n' in a little bash script.



Later when I want to reopen the tabs from the textfile I run this little loop:



#!/bin/bash

# usage: $bash Open-tabs.sh file-with-bookmarks.txt

while read -r line; do
firefox -new-tab "$line" 2>/dev/null &
sleep 2
done < "$1"


and it opens all tabs with a delay of 2 seconds.



I would like to know if there is a way, I can read-out the urls of the opened tabs from the command line, so I could include it to my script?










share|improve this question





























    6















    I sometimes have quite a big range of tabs open in Firefox and I prefer it to save them to a file, rather then using the build-in bookmarks.



    Therefore I (manually) copy the urls from the about:preferences page, save them to a file and process the file with: tr '|' 'n' in a little bash script.



    Later when I want to reopen the tabs from the textfile I run this little loop:



    #!/bin/bash

    # usage: $bash Open-tabs.sh file-with-bookmarks.txt

    while read -r line; do
    firefox -new-tab "$line" 2>/dev/null &
    sleep 2
    done < "$1"


    and it opens all tabs with a delay of 2 seconds.



    I would like to know if there is a way, I can read-out the urls of the opened tabs from the command line, so I could include it to my script?










    share|improve this question

























      6












      6








      6


      1






      I sometimes have quite a big range of tabs open in Firefox and I prefer it to save them to a file, rather then using the build-in bookmarks.



      Therefore I (manually) copy the urls from the about:preferences page, save them to a file and process the file with: tr '|' 'n' in a little bash script.



      Later when I want to reopen the tabs from the textfile I run this little loop:



      #!/bin/bash

      # usage: $bash Open-tabs.sh file-with-bookmarks.txt

      while read -r line; do
      firefox -new-tab "$line" 2>/dev/null &
      sleep 2
      done < "$1"


      and it opens all tabs with a delay of 2 seconds.



      I would like to know if there is a way, I can read-out the urls of the opened tabs from the command line, so I could include it to my script?










      share|improve this question














      I sometimes have quite a big range of tabs open in Firefox and I prefer it to save them to a file, rather then using the build-in bookmarks.



      Therefore I (manually) copy the urls from the about:preferences page, save them to a file and process the file with: tr '|' 'n' in a little bash script.



      Later when I want to reopen the tabs from the textfile I run this little loop:



      #!/bin/bash

      # usage: $bash Open-tabs.sh file-with-bookmarks.txt

      while read -r line; do
      firefox -new-tab "$line" 2>/dev/null &
      sleep 2
      done < "$1"


      and it opens all tabs with a delay of 2 seconds.



      I would like to know if there is a way, I can read-out the urls of the opened tabs from the command line, so I could include it to my script?







      bash command-line firefox url






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 9 '17 at 17:51









      nathnath

      1,078832




      1,078832






















          2 Answers
          2






          active

          oldest

          votes


















          4














          Source(Changed file path) : Get all the open tabs



          This snippet gets the current firefox tab url's. It uses the
          recovery.js file in your profile folder. That file is updated
          almost instantly, however it will not always be the correct url.



          Get all the open tabs:



          python2 <<< $'import jsonnf = open("/home/<username>/.mozilla/firefox/<name of the random stringed folder>.default/sessionstore-backups/recovery.js", "r")njdata = json.loads(f.read())nf.close()nfor win in jdata.get("windows"):ntfor tab in win.get("tabs"):ntti = tab.get("index") - 1nttprint tab.get("entries")[i].get("url")'





          share|improve this answer


























          • is it possible, the path on debian is ~/.mozilla/firefox/*.default/sessionstore-backups/recovery.js?

            – nath
            Aug 9 '17 at 18:48











          • Yes sorry I edited the question with that but I forgot the sessionrestore-backups before recovery.js. Thank you for pointing it out. Edited Answer

            – Hunter.S.Thompson
            Aug 9 '17 at 18:49











          • I always get Traceback (most recent call last): File "<stdin>", line 2, in <module> IOError: [Errno 2] No such file or directory: '~/.mozilla/firefox/*.default/sessionstore-backups/recovery.js' with cat I can read the file...

            – nath
            Aug 9 '17 at 19:15











          • I edited the answer. copy and paste it, but instead of <username> add your username.

            – Hunter.S.Thompson
            Aug 9 '17 at 19:17











          • Python probably does not understand the ~/ syntax being /home/<username>.

            – Hunter.S.Thompson
            Aug 9 '17 at 19:19





















          4














          this works for Firefox 57+. You'll need lz4 (via pip). The file header is gathered from the length of b'mozLz40'. Use an environment variable for the filepath if you want to use it in a oneliner, replace with n and t accordingly and merge lines.



          export opentabs=$(find ~/.mozilla/firefox*/*.default/sessionstore-backups/recovery.jsonlz4);

          python3 <<< $'import os, json, lz4.block
          f = open(os.environ["opentabs"], "rb")
          magic = f.read(8)
          jdata = json.loads(lz4.block.decompress(f.read()).decode("utf-8"))
          f.close()
          for win in jdata.get("windows"):
          for tab in win.get("tabs"):
          i = int(tab.get("index")) - 1
          urls = tab.get("entries")[i].get("url")
          print(urls)'





          share|improve this answer


























          • To get the latest needed file from firefox : export opentabs=$(ls -t ~/.mozilla/firefox*/*/sessionstore-backups/recovery.jsonlz4 | sed q)

            – Gilles Quenot
            Jan 4 '18 at 0:26











          • Can you explain magic = f.read(8) ? You don't use magic var later.

            – Gilles Quenot
            Jan 4 '18 at 12:19






          • 1





            the first 8 bytes in recovery.jsonlz4 are part of mozillas custom file format - passing the length of the magic to read(8) causes the next read() within json.loads to continue after the header, making it a valid decompressable lz4 stream. For the reasoning to choose a custom file header, you can find more details in this github gist linking to the relevant firefox source.

            – wbob
            Jan 6 '18 at 11:11













          • @wbob Now I get UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf2 in position 12: invalid continuation byte, can you help ?

            – SebMa
            Jun 14 '18 at 17:22











          • @Sebma I updated to lz4 2.0.0 and got the error too, your edit fixed it, thank you. I went ahead and merged the module imports

            – wbob
            Jun 20 '18 at 19:25












          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%2f385023%2ffirefox-reading-out-urls-of-opened-tabs-from-the-command-line%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          Source(Changed file path) : Get all the open tabs



          This snippet gets the current firefox tab url's. It uses the
          recovery.js file in your profile folder. That file is updated
          almost instantly, however it will not always be the correct url.



          Get all the open tabs:



          python2 <<< $'import jsonnf = open("/home/<username>/.mozilla/firefox/<name of the random stringed folder>.default/sessionstore-backups/recovery.js", "r")njdata = json.loads(f.read())nf.close()nfor win in jdata.get("windows"):ntfor tab in win.get("tabs"):ntti = tab.get("index") - 1nttprint tab.get("entries")[i].get("url")'





          share|improve this answer


























          • is it possible, the path on debian is ~/.mozilla/firefox/*.default/sessionstore-backups/recovery.js?

            – nath
            Aug 9 '17 at 18:48











          • Yes sorry I edited the question with that but I forgot the sessionrestore-backups before recovery.js. Thank you for pointing it out. Edited Answer

            – Hunter.S.Thompson
            Aug 9 '17 at 18:49











          • I always get Traceback (most recent call last): File "<stdin>", line 2, in <module> IOError: [Errno 2] No such file or directory: '~/.mozilla/firefox/*.default/sessionstore-backups/recovery.js' with cat I can read the file...

            – nath
            Aug 9 '17 at 19:15











          • I edited the answer. copy and paste it, but instead of <username> add your username.

            – Hunter.S.Thompson
            Aug 9 '17 at 19:17











          • Python probably does not understand the ~/ syntax being /home/<username>.

            – Hunter.S.Thompson
            Aug 9 '17 at 19:19


















          4














          Source(Changed file path) : Get all the open tabs



          This snippet gets the current firefox tab url's. It uses the
          recovery.js file in your profile folder. That file is updated
          almost instantly, however it will not always be the correct url.



          Get all the open tabs:



          python2 <<< $'import jsonnf = open("/home/<username>/.mozilla/firefox/<name of the random stringed folder>.default/sessionstore-backups/recovery.js", "r")njdata = json.loads(f.read())nf.close()nfor win in jdata.get("windows"):ntfor tab in win.get("tabs"):ntti = tab.get("index") - 1nttprint tab.get("entries")[i].get("url")'





          share|improve this answer


























          • is it possible, the path on debian is ~/.mozilla/firefox/*.default/sessionstore-backups/recovery.js?

            – nath
            Aug 9 '17 at 18:48











          • Yes sorry I edited the question with that but I forgot the sessionrestore-backups before recovery.js. Thank you for pointing it out. Edited Answer

            – Hunter.S.Thompson
            Aug 9 '17 at 18:49











          • I always get Traceback (most recent call last): File "<stdin>", line 2, in <module> IOError: [Errno 2] No such file or directory: '~/.mozilla/firefox/*.default/sessionstore-backups/recovery.js' with cat I can read the file...

            – nath
            Aug 9 '17 at 19:15











          • I edited the answer. copy and paste it, but instead of <username> add your username.

            – Hunter.S.Thompson
            Aug 9 '17 at 19:17











          • Python probably does not understand the ~/ syntax being /home/<username>.

            – Hunter.S.Thompson
            Aug 9 '17 at 19:19
















          4












          4








          4







          Source(Changed file path) : Get all the open tabs



          This snippet gets the current firefox tab url's. It uses the
          recovery.js file in your profile folder. That file is updated
          almost instantly, however it will not always be the correct url.



          Get all the open tabs:



          python2 <<< $'import jsonnf = open("/home/<username>/.mozilla/firefox/<name of the random stringed folder>.default/sessionstore-backups/recovery.js", "r")njdata = json.loads(f.read())nf.close()nfor win in jdata.get("windows"):ntfor tab in win.get("tabs"):ntti = tab.get("index") - 1nttprint tab.get("entries")[i].get("url")'





          share|improve this answer















          Source(Changed file path) : Get all the open tabs



          This snippet gets the current firefox tab url's. It uses the
          recovery.js file in your profile folder. That file is updated
          almost instantly, however it will not always be the correct url.



          Get all the open tabs:



          python2 <<< $'import jsonnf = open("/home/<username>/.mozilla/firefox/<name of the random stringed folder>.default/sessionstore-backups/recovery.js", "r")njdata = json.loads(f.read())nf.close()nfor win in jdata.get("windows"):ntfor tab in win.get("tabs"):ntti = tab.get("index") - 1nttprint tab.get("entries")[i].get("url")'






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 10 '17 at 20:20

























          answered Aug 9 '17 at 18:04









          Hunter.S.ThompsonHunter.S.Thompson

          5,85151436




          5,85151436













          • is it possible, the path on debian is ~/.mozilla/firefox/*.default/sessionstore-backups/recovery.js?

            – nath
            Aug 9 '17 at 18:48











          • Yes sorry I edited the question with that but I forgot the sessionrestore-backups before recovery.js. Thank you for pointing it out. Edited Answer

            – Hunter.S.Thompson
            Aug 9 '17 at 18:49











          • I always get Traceback (most recent call last): File "<stdin>", line 2, in <module> IOError: [Errno 2] No such file or directory: '~/.mozilla/firefox/*.default/sessionstore-backups/recovery.js' with cat I can read the file...

            – nath
            Aug 9 '17 at 19:15











          • I edited the answer. copy and paste it, but instead of <username> add your username.

            – Hunter.S.Thompson
            Aug 9 '17 at 19:17











          • Python probably does not understand the ~/ syntax being /home/<username>.

            – Hunter.S.Thompson
            Aug 9 '17 at 19:19





















          • is it possible, the path on debian is ~/.mozilla/firefox/*.default/sessionstore-backups/recovery.js?

            – nath
            Aug 9 '17 at 18:48











          • Yes sorry I edited the question with that but I forgot the sessionrestore-backups before recovery.js. Thank you for pointing it out. Edited Answer

            – Hunter.S.Thompson
            Aug 9 '17 at 18:49











          • I always get Traceback (most recent call last): File "<stdin>", line 2, in <module> IOError: [Errno 2] No such file or directory: '~/.mozilla/firefox/*.default/sessionstore-backups/recovery.js' with cat I can read the file...

            – nath
            Aug 9 '17 at 19:15











          • I edited the answer. copy and paste it, but instead of <username> add your username.

            – Hunter.S.Thompson
            Aug 9 '17 at 19:17











          • Python probably does not understand the ~/ syntax being /home/<username>.

            – Hunter.S.Thompson
            Aug 9 '17 at 19:19



















          is it possible, the path on debian is ~/.mozilla/firefox/*.default/sessionstore-backups/recovery.js?

          – nath
          Aug 9 '17 at 18:48





          is it possible, the path on debian is ~/.mozilla/firefox/*.default/sessionstore-backups/recovery.js?

          – nath
          Aug 9 '17 at 18:48













          Yes sorry I edited the question with that but I forgot the sessionrestore-backups before recovery.js. Thank you for pointing it out. Edited Answer

          – Hunter.S.Thompson
          Aug 9 '17 at 18:49





          Yes sorry I edited the question with that but I forgot the sessionrestore-backups before recovery.js. Thank you for pointing it out. Edited Answer

          – Hunter.S.Thompson
          Aug 9 '17 at 18:49













          I always get Traceback (most recent call last): File "<stdin>", line 2, in <module> IOError: [Errno 2] No such file or directory: '~/.mozilla/firefox/*.default/sessionstore-backups/recovery.js' with cat I can read the file...

          – nath
          Aug 9 '17 at 19:15





          I always get Traceback (most recent call last): File "<stdin>", line 2, in <module> IOError: [Errno 2] No such file or directory: '~/.mozilla/firefox/*.default/sessionstore-backups/recovery.js' with cat I can read the file...

          – nath
          Aug 9 '17 at 19:15













          I edited the answer. copy and paste it, but instead of <username> add your username.

          – Hunter.S.Thompson
          Aug 9 '17 at 19:17





          I edited the answer. copy and paste it, but instead of <username> add your username.

          – Hunter.S.Thompson
          Aug 9 '17 at 19:17













          Python probably does not understand the ~/ syntax being /home/<username>.

          – Hunter.S.Thompson
          Aug 9 '17 at 19:19







          Python probably does not understand the ~/ syntax being /home/<username>.

          – Hunter.S.Thompson
          Aug 9 '17 at 19:19















          4














          this works for Firefox 57+. You'll need lz4 (via pip). The file header is gathered from the length of b'mozLz40'. Use an environment variable for the filepath if you want to use it in a oneliner, replace with n and t accordingly and merge lines.



          export opentabs=$(find ~/.mozilla/firefox*/*.default/sessionstore-backups/recovery.jsonlz4);

          python3 <<< $'import os, json, lz4.block
          f = open(os.environ["opentabs"], "rb")
          magic = f.read(8)
          jdata = json.loads(lz4.block.decompress(f.read()).decode("utf-8"))
          f.close()
          for win in jdata.get("windows"):
          for tab in win.get("tabs"):
          i = int(tab.get("index")) - 1
          urls = tab.get("entries")[i].get("url")
          print(urls)'





          share|improve this answer


























          • To get the latest needed file from firefox : export opentabs=$(ls -t ~/.mozilla/firefox*/*/sessionstore-backups/recovery.jsonlz4 | sed q)

            – Gilles Quenot
            Jan 4 '18 at 0:26











          • Can you explain magic = f.read(8) ? You don't use magic var later.

            – Gilles Quenot
            Jan 4 '18 at 12:19






          • 1





            the first 8 bytes in recovery.jsonlz4 are part of mozillas custom file format - passing the length of the magic to read(8) causes the next read() within json.loads to continue after the header, making it a valid decompressable lz4 stream. For the reasoning to choose a custom file header, you can find more details in this github gist linking to the relevant firefox source.

            – wbob
            Jan 6 '18 at 11:11













          • @wbob Now I get UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf2 in position 12: invalid continuation byte, can you help ?

            – SebMa
            Jun 14 '18 at 17:22











          • @Sebma I updated to lz4 2.0.0 and got the error too, your edit fixed it, thank you. I went ahead and merged the module imports

            – wbob
            Jun 20 '18 at 19:25
















          4














          this works for Firefox 57+. You'll need lz4 (via pip). The file header is gathered from the length of b'mozLz40'. Use an environment variable for the filepath if you want to use it in a oneliner, replace with n and t accordingly and merge lines.



          export opentabs=$(find ~/.mozilla/firefox*/*.default/sessionstore-backups/recovery.jsonlz4);

          python3 <<< $'import os, json, lz4.block
          f = open(os.environ["opentabs"], "rb")
          magic = f.read(8)
          jdata = json.loads(lz4.block.decompress(f.read()).decode("utf-8"))
          f.close()
          for win in jdata.get("windows"):
          for tab in win.get("tabs"):
          i = int(tab.get("index")) - 1
          urls = tab.get("entries")[i].get("url")
          print(urls)'





          share|improve this answer


























          • To get the latest needed file from firefox : export opentabs=$(ls -t ~/.mozilla/firefox*/*/sessionstore-backups/recovery.jsonlz4 | sed q)

            – Gilles Quenot
            Jan 4 '18 at 0:26











          • Can you explain magic = f.read(8) ? You don't use magic var later.

            – Gilles Quenot
            Jan 4 '18 at 12:19






          • 1





            the first 8 bytes in recovery.jsonlz4 are part of mozillas custom file format - passing the length of the magic to read(8) causes the next read() within json.loads to continue after the header, making it a valid decompressable lz4 stream. For the reasoning to choose a custom file header, you can find more details in this github gist linking to the relevant firefox source.

            – wbob
            Jan 6 '18 at 11:11













          • @wbob Now I get UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf2 in position 12: invalid continuation byte, can you help ?

            – SebMa
            Jun 14 '18 at 17:22











          • @Sebma I updated to lz4 2.0.0 and got the error too, your edit fixed it, thank you. I went ahead and merged the module imports

            – wbob
            Jun 20 '18 at 19:25














          4












          4








          4







          this works for Firefox 57+. You'll need lz4 (via pip). The file header is gathered from the length of b'mozLz40'. Use an environment variable for the filepath if you want to use it in a oneliner, replace with n and t accordingly and merge lines.



          export opentabs=$(find ~/.mozilla/firefox*/*.default/sessionstore-backups/recovery.jsonlz4);

          python3 <<< $'import os, json, lz4.block
          f = open(os.environ["opentabs"], "rb")
          magic = f.read(8)
          jdata = json.loads(lz4.block.decompress(f.read()).decode("utf-8"))
          f.close()
          for win in jdata.get("windows"):
          for tab in win.get("tabs"):
          i = int(tab.get("index")) - 1
          urls = tab.get("entries")[i].get("url")
          print(urls)'





          share|improve this answer















          this works for Firefox 57+. You'll need lz4 (via pip). The file header is gathered from the length of b'mozLz40'. Use an environment variable for the filepath if you want to use it in a oneliner, replace with n and t accordingly and merge lines.



          export opentabs=$(find ~/.mozilla/firefox*/*.default/sessionstore-backups/recovery.jsonlz4);

          python3 <<< $'import os, json, lz4.block
          f = open(os.environ["opentabs"], "rb")
          magic = f.read(8)
          jdata = json.loads(lz4.block.decompress(f.read()).decode("utf-8"))
          f.close()
          for win in jdata.get("windows"):
          for tab in win.get("tabs"):
          i = int(tab.get("index")) - 1
          urls = tab.get("entries")[i].get("url")
          print(urls)'






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 1 hour ago

























          answered Aug 30 '17 at 21:04









          wbobwbob

          662




          662













          • To get the latest needed file from firefox : export opentabs=$(ls -t ~/.mozilla/firefox*/*/sessionstore-backups/recovery.jsonlz4 | sed q)

            – Gilles Quenot
            Jan 4 '18 at 0:26











          • Can you explain magic = f.read(8) ? You don't use magic var later.

            – Gilles Quenot
            Jan 4 '18 at 12:19






          • 1





            the first 8 bytes in recovery.jsonlz4 are part of mozillas custom file format - passing the length of the magic to read(8) causes the next read() within json.loads to continue after the header, making it a valid decompressable lz4 stream. For the reasoning to choose a custom file header, you can find more details in this github gist linking to the relevant firefox source.

            – wbob
            Jan 6 '18 at 11:11













          • @wbob Now I get UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf2 in position 12: invalid continuation byte, can you help ?

            – SebMa
            Jun 14 '18 at 17:22











          • @Sebma I updated to lz4 2.0.0 and got the error too, your edit fixed it, thank you. I went ahead and merged the module imports

            – wbob
            Jun 20 '18 at 19:25



















          • To get the latest needed file from firefox : export opentabs=$(ls -t ~/.mozilla/firefox*/*/sessionstore-backups/recovery.jsonlz4 | sed q)

            – Gilles Quenot
            Jan 4 '18 at 0:26











          • Can you explain magic = f.read(8) ? You don't use magic var later.

            – Gilles Quenot
            Jan 4 '18 at 12:19






          • 1





            the first 8 bytes in recovery.jsonlz4 are part of mozillas custom file format - passing the length of the magic to read(8) causes the next read() within json.loads to continue after the header, making it a valid decompressable lz4 stream. For the reasoning to choose a custom file header, you can find more details in this github gist linking to the relevant firefox source.

            – wbob
            Jan 6 '18 at 11:11













          • @wbob Now I get UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf2 in position 12: invalid continuation byte, can you help ?

            – SebMa
            Jun 14 '18 at 17:22











          • @Sebma I updated to lz4 2.0.0 and got the error too, your edit fixed it, thank you. I went ahead and merged the module imports

            – wbob
            Jun 20 '18 at 19:25

















          To get the latest needed file from firefox : export opentabs=$(ls -t ~/.mozilla/firefox*/*/sessionstore-backups/recovery.jsonlz4 | sed q)

          – Gilles Quenot
          Jan 4 '18 at 0:26





          To get the latest needed file from firefox : export opentabs=$(ls -t ~/.mozilla/firefox*/*/sessionstore-backups/recovery.jsonlz4 | sed q)

          – Gilles Quenot
          Jan 4 '18 at 0:26













          Can you explain magic = f.read(8) ? You don't use magic var later.

          – Gilles Quenot
          Jan 4 '18 at 12:19





          Can you explain magic = f.read(8) ? You don't use magic var later.

          – Gilles Quenot
          Jan 4 '18 at 12:19




          1




          1





          the first 8 bytes in recovery.jsonlz4 are part of mozillas custom file format - passing the length of the magic to read(8) causes the next read() within json.loads to continue after the header, making it a valid decompressable lz4 stream. For the reasoning to choose a custom file header, you can find more details in this github gist linking to the relevant firefox source.

          – wbob
          Jan 6 '18 at 11:11







          the first 8 bytes in recovery.jsonlz4 are part of mozillas custom file format - passing the length of the magic to read(8) causes the next read() within json.loads to continue after the header, making it a valid decompressable lz4 stream. For the reasoning to choose a custom file header, you can find more details in this github gist linking to the relevant firefox source.

          – wbob
          Jan 6 '18 at 11:11















          @wbob Now I get UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf2 in position 12: invalid continuation byte, can you help ?

          – SebMa
          Jun 14 '18 at 17:22





          @wbob Now I get UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf2 in position 12: invalid continuation byte, can you help ?

          – SebMa
          Jun 14 '18 at 17:22













          @Sebma I updated to lz4 2.0.0 and got the error too, your edit fixed it, thank you. I went ahead and merged the module imports

          – wbob
          Jun 20 '18 at 19:25





          @Sebma I updated to lz4 2.0.0 and got the error too, your edit fixed it, thank you. I went ahead and merged the module imports

          – wbob
          Jun 20 '18 at 19:25


















          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%2f385023%2ffirefox-reading-out-urls-of-opened-tabs-from-the-command-line%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

          Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

          The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

          Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...