Artificial intelligent assistant

Firefox - reading out urls of opened tabs from the command-line 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?

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

This snippet gets the current firefox tab url's. It uses the `recovery.js[onlz4]` 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:


python -c '
import io, json, pathlib as p
fpath = next(iter(p.Path("~/.mozilla/firefox").expanduser().glob("*.default/sessionstore-backups/recovery.js*")))
with io.open(fpath, "rb") as fd:
if fpath.suffix == ".jsonlz4":
import lz4.block as lz4
fd.read(8) # b"mozLz40\0"
jdata = json.loads(lz4.decompress(fd.read()).decode("utf-8"))
else:
jdata = json.load(fd)
for win in jdata.get("windows"):
for tab in win.get("tabs"):
i = tab["index"] - 1
print(tab["entries"][i]["url"])
'

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 8faf15f0a3f8af451c2f3e758b2ddf93