Extracting open URLs from sessionstore.js?

User Help for Mozilla Firefox
niko39
Posts: 6
Joined: March 6th, 2005, 9:47 am

Re:

Post by niko39 »

trolly wrote:If you had several windows open you get multiple "windows" entries.
"tabs" defines a tab and the "url" entries describe the complete stored history of that tab.

BTW: This extension (NightlyTesterTools adds a "Restore from last session" entry to the history menu. I forgot about it. :oops:
If you have it just create a new session and restore the tabs using that menu item.

Thank you very much trolly, that extension did the trick and my older sessions suddenly re-appeared :)
sputnick
Guest

Re: Extracting open URLs from sessionstore.js?

Post by sputnick »

You can list all opened tabs in CLI with this python script :

Code: Select all

#!/usr/bin/python

import json, sys
f = open(sys.argv[1], "r")
jdata = json.loads(f.read())
f.close()
for win in jdata.get("windows"):
    for tab in win.get("tabs"):
        i = tab.get("index") - 1
        print tab.get("entries")[i].get("url")


You need to adapt the first line for windows with your python path.
ALexander_Syros
Guest

Re: Extracting open URLs from sessionstore.js?

Post by ALexander_Syros »

I had a similar problem.
After a crash, FireFox didn't seem to be able to read the contents of the sessionstore.js (restored from a sessionstore.bak).

After hours of research and failed attempts, I came across this post:
dag.wieers.com/blog/what-if-firefox-loses-your-tabs

It turns out that the inner structure of my sessionstore.js file got screwed and all my tabs ended up in the _Closed_Windows section of the file. The solution was fairly simple. I just used jsoneditoronline.org to restructure the sessionstore.js file. It's a nice intuitive JSON editor, which allowed me to drag and drop the content from _ClosedWindows to windows).

Having edited the sessionstore.js file in this way, I copied it back to the FireFox profile folder, restarted the browser and bingo! Tab-whoring as usual now! :lol:

Props to dag from dag.wieers.com!
anu99
Posts: 6
Joined: April 11th, 2013, 1:50 pm

Re: Extracting open URLs from sessionstore.js?

Post by anu99 »

how is the id in a sessionstore.js is related to places.sqlite??

when i see the id's in a js file it is not even matching with the places.sqlite database.How to find it??
Mox83
Posts: 1
Joined: June 30th, 2013, 3:59 pm

Re: Extracting open URLs from sessionstore.js?

Post by Mox83 »

Run into the problem of FF not loading the .js file despite repeat attempts at restoring that and the .bak. Looking at the file in notepad, there don't appear to be any problems with the closed windows/tabs section that other users have reported, looks quite normal and has checked out ok with JSON verify. Firefox just keeps overwriting it and there is nothing in about:sessionrestore.....
There are about 900(!) tabs in that file essential for my work, and what I really need is a way to extract the urls quickly, preferably outputted to an html file with clickable links, otherwise it'll probably take a week to restore everything. I've tried the various methods on these pages, but nothing works, but that may be due to my inexperience with perl, java, php etc.
Can someone do a really dumbed down step by step method, or point me in the direction of one or a tool or something?
Locked