Skip to content

Instantly share code, notes, and snippets.

@tripu
Last active July 6, 2020 07:39
Show Gist options
  • Save tripu/9ce82a091aea410217ecb30052b5502f to your computer and use it in GitHub Desktop.
Save tripu/9ce82a091aea410217ecb30052b5502f to your computer and use it in GitHub Desktop.
How to download a copy of all your bookmarks

Limitations

This is for a Unix shell (because of for, cut, wget, etc) and for Firefox (because FF exports bookmarks as JSON, where each entry has a uri property). YMMV.

Preparation

  1. Make sure you have wget installed
  2. Install jq
  3. Export all your bookmarks (or a subset) as a JSON file:
    Ctrl+Shift+OImport and BackupBackup…
    (say you save it as /tmp/bookmarks.json)

Script

for i in `cat /tmp/bookmarks.json | jq '[.. | .uri? | select(.) ]' | cut -d '"' -f 2`; do
    wget -r -l 1 $i
done

This will create directories for each domain, under the current dir.
Pass larger integers to wget param -l if you want to dig deeper into each URL.


Thanks to jq recipes

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