Skip to content

Instantly share code, notes, and snippets.

@Blakeinstein
Created January 11, 2023 19:50
Show Gist options
  • Save Blakeinstein/0cdf4a17ad3dc2e440e8dd389f5f7aba to your computer and use it in GitHub Desktop.
Save Blakeinstein/0cdf4a17ad3dc2e440e8dd389f5f7aba to your computer and use it in GitHub Desktop.
Move Microsoft EDGE collections to raindrop / csv

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
  1. 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.

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"]
)
@Blakeinstein
Copy link
Author

This is not clear ..............some steps must be missing.........

Ah think I could have worded that differently.

  1. Create a file called collections_to_csv.py in the same folder as you found the db files (You can find the relevant folder from the step Get the sqlite db file
  2. Install python You can find instructions here
  3. Python comes with a package manager, pip on a command line run pip install pandas
  4. Use the command line to execute collections_to_csv.py on the same folder by executing python collections_to_csv.py

I can help you better if you can tell me what platform/OS you are on.

@Blakeinstein
Copy link
Author

Do note its been a solid minute since I wrote this, Microsoft may have updated their schema.

@Davecon11
Copy link

Davecon11 commented Jun 24, 2024 via email

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