Created
July 18, 2020 02:44
-
-
Save gdlmx/31b59b65761f3f5cb9a7045e3d943c39 to your computer and use it in GitHub Desktop.
Export Firefox bookmarks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3, pandas as pd | |
conn = sqlite3.connect('places.sqlite') | |
tinfo= pd.read_sql_query("SELECT * FROM pragma_table_info('moz_places')", conn) | |
cols = [ 'p.'+c for c in tinfo.name if 'id' not in c ] | |
tinfo = pd.read_sql_query("SELECT * FROM pragma_table_info('moz_bookmarks')", conn) | |
cols += [ 'b.'+c for c in tinfo.name if 'id' not in c and 'title' not in c ] | |
tbmk = pd.read_sql_query("SELECT {0} FROM moz_bookmarks b INNER JOIN moz_places p ON b.fk = p.id".format( ', '.join(cols) ), | |
conn); | |
for c in tbmk: | |
if 'date' in c or c.startswith('last'): | |
tbmk[c] = pd.to_datetime(tbmk[c], unit='us', errors='coerce') | |
tbmk.to_excel('places.xlsx') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment