Created
January 11, 2023 19:50
Revisions
-
Blakeinstein created this gist
Jan 11, 2023 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ # Move Microsoft edge collections to services like Raindrop (that can accept csv) ## Get the sqlite db file 1. You can find the db file in the following places - Windows: `%LocalAppData%\Microsoft\Edge\User Data\Default\Collections` - MacOS: `~/Library/Application Support/Microsoft Edge/Default/Collections` - Linux: TBD 2. Copy the files (esp. `collectionsSQLite`) to a seperate Folder. ## Execute the script 1. Install python 3.10 and then setup pandas via pip `pip install pandas` 2. save `collections_to_csv.py` to the same folder with the db files from the previous step. 3. Exec the script `python collections_to_csv.py` Then you can simply import the file normally to raindrop. 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ import json import sqlite3 import pandas as pd con = sqlite3.connect("./collectionsSQLite") cur = con.cursor() df = pd.read_sql_query( """ SELECT i.title as title, c.title as folder, i.source as data, i.date_created as created FROM collections as c, items as i, collections_items_relationship as r WHERE r.item_id == i.id and r.parent_id == c.id """, con ) def blob_to_json(col): my_json = col.decode('utf8') d = json.loads(my_json) return d["url"] df["description"] = "" df["tags"] = "" df["created"] = df["created"].astype(int) df["url"] = df["data"].apply(blob_to_json) df.to_csv( "out.csv", index=False, columns=["url", "folder", "title", "description", "tags", "created"] )