问题
I have LevelDB (IndexedDB) file from my Google Chrome, the file is located in this folder:
/home/<user>/.config/google-chrome/Default/IndexedDB/https_<site>_0.indexeddb.leveldb/
The folder content is:
$ ls
000005.ldb 000006.log CURRENT LOCK LOG MANIFEST-000001
And I have a very simple python script for opening it:
#!/bin/python
import leveldb
db = leveldb.LevelDB('./000005.ldb')
Now I always get this error:
leveldb.LevelDBError: IO error: ./000005.ldb/LOCK: Not a directory
Does anyone have information about how correctly access the data stored in my IndexDB files? Basically, I just need to get the same information like from the 'Developers Tool' view but using Bash or Python.
回答1:
You have to open the directory with this API, not a file. Also it worth noting that using plyvel library is probably better:
import plyvel
db = plyvel.DB('/home/<user>/.config/google-chrome/Default/IndexedDB/https_<site>_0.indexeddb.leveldb')
for key, value in db:
print("{0} : {1}".format(key, value))
来源:https://stackoverflow.com/questions/53704997/getting-data-inside-a-google-chrome-indexeddb-from-bash-or-python