Skip to content

Instantly share code, notes, and snippets.

@jewel-andraia
Last active December 11, 2021 06:24
Show Gist options
  • Save jewel-andraia/9294509 to your computer and use it in GitHub Desktop.
Save jewel-andraia/9294509 to your computer and use it in GitHub Desktop.
@gavin19's RES settings backup script

@gavin19 said...:

I [gavin19] also wrote this very simple Python script that can take a Chrome chrome-extension_kbm..localstorage file as input and output to the Firefox store.json type. Just copy the old Chrome settings file to the same directory as the script and rename to res.db. Running python chrToFF.py should output a valid Firefox-worthy replica.

import json
import codecs
import sqlite3 as sq
con = sq.connect('res.db')
cur = con.cursor()
db = cur.execute('SELECT key, CAST(value as TEXT) FROM ItemTable').fetchall()
with codecs.open('store.json', 'w', 'utf-8') as f:
dump = json.dumps(dict(db))
f.write(dump)
@obihann
Copy link

obihann commented Mar 21, 2014

Going the other way around I assume would be just as simple, in that your parsing through the JSON file and then creating a SQLite dump? I I may fork this and attempt it myself as I want to go FF-Chrome instead of the other way around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment