Skip to content

Instantly share code, notes, and snippets.

@Blakeinstein
Created January 11, 2023 19:50
  • Select an option

Select an option

Revisions

  1. Blakeinstein created this gist Jan 11, 2023.
    17 changes: 17 additions & 0 deletions README.md
    Original 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.
    31 changes: 31 additions & 0 deletions collections_to_csv.py
    Original 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"]
    )