Mirrors browser bookmarks to your local filesystem, replicating the directory structure and converting bookmarks into internet shortcuts.
This script can take either the Bookmarks
file that Chromium-based browsers use to store bookmarks or a Netscape Bookmark File (the .html file typically generated when you export your bookmarks from a browser) as input.
The Bookmarks
file that Chromium-based browsers use to store bookmarks is typically:
"%appdata%\Local\Google\Chrome\User Data\Default\Bookmarks" # Windows
"~/.config/google-chrome/Default/Bookmarks" # Linux
"~/Library/Application Support/Google/Chrome/Default/Bookmarks" # MacOS
The filepath may vary depending on the user profile that you're using in the browser (i.e. not Default). Other Chromium-based browsers should store their bookmarks in a similar filepath relative to the browser's folder.
Alternatively, a Netscape bookmarks file can be generated by exporting your browser bookmarks: Chrome: https://support.google.com/chrome/answer/96816?hl=en Firefox: https://support.mozilla.org/en-US/kb/export-firefox-bookmarks-to-backup-or-transfer
As for usage of the script itself:
❯ python main.py -h
usage: main.py [-h] [-f {chromium,netscape}] [-o OUTPUT] input
Mirrors browser bookmarks to your local filesystem, replicating the directory structure and converting bookmarks into internet shortcuts.
positional arguments:
input The input file to read bookmarks from.
options:
-h, --help show this help message and exit
-f {chromium,netscape}, --format {chromium,netscape}
The format of the input file. Can either be the Chromium Bookmarks file or a Netscape Bookmark File. If not specified, the format will be inferred from the file
extension.
-o OUTPUT, --output OUTPUT
The output folder to write the bookmarks to. If not specified, the output folder will be the current working directory.
- Does not properly support bookmarks that point towards files (e.g. PDFs or images)
- Does not handle certain edge-cases in the directory structure that bookmarks support but filesystems usually do not
- Folder and bookmark being named the same
- Multiple bookmarks or bookmark folders in the same directory being named the same