bookmarks_scrubber scrubs out (Firefox JSON) bookmark entries (URLs & folders) with titles that begin with -- (double dashes). This also makes it easier to visually see them in the Bookmarks Organizers.
bookmarks_jstree will generate the data for the wonderful jstree of my (Firefox JSON) bookmarks.
Backup your (Firefox) bookmarks to JSON file.
- Menu
- Bookmarks
- Show All Bookmarks (CTRL+Shift+O)
- Import and Backup
- Backup...
- Save <bookmarks-yyyy-mm-dd.json> file
Scrub the bookmarks:
python bookmarks_scrubber.py -s -i bookmarks-yyyy-mm-dd.json -o bookmarks-scrubbed.json
Generate the jstree data json file:
python bookmarks_jstree.py -i bookmarks-scrubbed.json -o jstree-data.json
OR -- Pipe the scripts together:
cat bookmarks-yyyy-mm-dd.json | python bookmarks_scrubber.py -s | python bookmarks_jstree.py > jstree-data.json
Upload the jstree-data.json and bookmarks_jstree.{php,html} files up to your webserver.
These two files are essentially the same. The PHP version will inline the jstree data while the HTML version will fetch it separately. Use whichever version suits your need.
Usage:
./bookmarks_jstree.py [options]
Options are:
-h, --help
This usage message.
-i filename, --input=filename
Read JSON data from [ filename ] or else, read data from [ stdin ].
-o filename, --output=filename
Output results to [ filename ] or else, output to [ stdout ].
Special Note: Titles that start with *** (triple stars) will be displayed in BOLD.
Usage:
./bookmarks_scrubber.py [options]
Options are:
-h, --help
This usage message.
-i filename, --input=filename
Read JSON data from [ filename ] or else, read data from [ stdin ].
-o filename, --output=filename
Output results to [ filename ] or else, output to [ stdout ].
-r title, --root=title
Start root at [title] folder. Note: first match only!
No multiple match warnings will be given.
-s, --scrub
Scrub JSON entries with titles that start with -- (double dashes).
-t title, --scrubtitles=title
Additional FOLDERS (titles) to scrub out.
This can be stacked: --scrubtitle=title1 --scrubtitle=title2 etc.
(Scrubbing individual URLs is left as an exercise.)
Take a look at the following bookmark library example.
By just glancing, you will be able to quickly tell which folders and files will be scrubbed out -- as well as which ones will be displayed in bold.
After running the commands shown in the quick start section, here is the result of this example.
View my latest BOOKMARKS ONLINE.
Use (for example) lz4jsoncat with these tools:
BKMRKS=~/.mozilla/firefox/*.default/bookmarkbackups; ./lz4jsoncat $BKMRKS/`ls -t $BKMRKS | head -1` | \
python bookmarks_scrubber.py -s | python bookmarks_jstree.py > jstree-data.json
See the following stackexchange post for additional information on how to build lz4jsoncat.