This Script Copies Description, Separators, etc. from HTML to Existing Vivaldi Bookmarks
GJS last edited by GJS
annotate_vivaldi_bookmarks.plcopies bookmark Descriptions, Nicknames, Tags, and Separators from a Firefox bookmarks HTML file to existing Vivaldi bookmarks. It does not import bookmarks and their properties, but you can do that in two steps.
I wrote the script to solve the following problem, and polished it up in hopes it will be useful to others.
In 2019, before Firefox abandoned support for Bookmark Descriptions, I saved mine by exporting a Firefox HTML Bookmarks file. Subsequently in Firefox I added, deleted, and reorganized various bookmarks. Eventually I imported the new bookmarks tree into Vivaldi (losing Separators), and made further additions and changes (including Descriptions and Nicknames). Now I wanted to restore the Descriptions etc. from the old HTML file into my current Vivaldi bookmarks, wherever they may be in the current bookmarks tree.
That is what this script does. It matches bookmarks from the HTML to bookmarks in Vivaldi by Date Added, URL, Name, and a portion of the folder path, and copies the properties to that match.
Here is an example run (on Windows 10). Thirty warnings and notes may seem like a lot, but it's only 2% compared to the number of changes made.
set BOOKMARKS="%LOCALAPPDATA%\Vivaldi\User Data\Default\Bookmarks" set HTML="C:\Data\WWW\Checkpoints\GJS Bookmarks 2019-07-18 1732.html" perl -S annotate_vivaldi_bookmarks.pl -trees %HTML% %BOOKMARKS% annotate_vivaldi_bookmarks.pl - Checking Vivaldi Profile Lock ... annotate_vivaldi_bookmarks.pl - Backing up Vivaldi Bookmarks (JSON file) ... annotate_vivaldi_bookmarks.pl - NOTE: 'Default/Bookmarks' backup copy is still current. annotate_vivaldi_bookmarks.pl (./Default/Checkpoints/Bookmarks 2021-02-25 1755). annotate_vivaldi_bookmarks.pl - Reading JSON Bookmarks ... annotate_vivaldi_bookmarks.pl - Processing HTML Bookmarks ... annotate_vivaldi_bookmarks.pl - WARNING: Folder not found: New Bookmarks annotate_vivaldi_bookmarks.pl - WARNING: Bookmark not found: TT18D: Formosa Oolong Choicest - 160g (... 25 more messages ...) annotate_vivaldi_bookmarks.pl - WARNING: Folder not unique: Forums annotate_vivaldi_bookmarks.pl - NOTE: Bookmark has moved: Using the viewport meta tag to control ... annotate_vivaldi_bookmarks.pl - WARNING: Bookmark not found: d some annotate_vivaldi_bookmarks.pl - Writing JSON Bookmarks ... annotate_vivaldi_bookmarks.pl - Copying JSON Bookmarks to Vivaldi Profile ... annotate_vivaldi_bookmarks.pl - Checked 12,372 bookmarks and 2,571 folders in 13 seconds. annotate_vivaldi_bookmarks.pl - Updated 790 Descriptions, 6 Shortcuts, and 0 Tags. annotate_vivaldi_bookmarks.pl - Checked 1,037 Separators, added 997. 23 were already present. annotate_vivaldi_bookmarks.pl - Logged 16 WARNINGs and 14 NOTEs. annotate_vivaldi_bookmarks.pl - For details see 'annotate_vivaldi_bookmarks.log'.
The log file details the changes made and not made. It is intended as a preview before doing the update, and as an aid to making any needed corrections in Vivaldi afterward. Here is a sample entry:
NOTE: Bookmark has moved: Coffee Terms - Cupping and Tasting UPDATED Bookmark: x Bookmarks > Other Bookmarks > Coffee Terms - Cupping and Tasting > Bookmarks > Home > Food / Cooking > Coffee > Coffee Terms - Cupping and Tasting http://www.zecuppa.com/coffeeterms-cupping-tasting.htm Date Added: 06 Sep 2018, 9:47:17 AM > Description: Coffee Terms > Cupping, Tasting > Coffee term descriptions and illustrations
If you want to import an HTML Bookmarks file complete with Descriptions etc. into Vivaldi, you can:
- Import the HTML Bookmarks file into Vivaldi as usual to create the Folders, Bookmarks, URLs, and Favicons. Note the folder where Vivaldi placed the bookmarks, e.g. Imported (1).
- Run the script to finish the job, specifying the folder where the Descriptions etc. should be copied. For example:
> annotate_vivaldi_bookmarks -root "Imported (1)" ...
[Currently this script does not copy Bookmark Thumbnails. However, I could add an option without much trouble if anyone needs to import them.]
To run the script you need a Perl interpreter and libraries. I have tested the script on Windows 10 Home 20H2 with ActivePerl 5.24 and Strawberry Perl 5.32, both of which include everything needed. ActivePerl is also available for Linux and Mac.
Please let me know of any problems with the script.
Pathduck last edited by
This is great, well done
I don't use a lot of annotations for my ~800 bookmarks, I probably should, but I rely on a good folder structure to find what I need instead. I guess with 12k bookmarks it would not be enough to just rely on folders
Had a look at the code and documentation, looks really impressive! It would be fun to test it out, I would need to use a backup profile I guess as I'm not brave enough to run it directly on my main profile.
GJS last edited by GJS
@Pathduck -- Thanks for the compliment.
I too had to build up some courage before running the script on my main profile. I only did it after many runs in development/test profiles, and later in
-previewmode (which creates the log file but does not update the Vivaldi profile). If you are interested, and have an old HTML file with Descriptions or Separators for your current bookmarks, you could try running the script with
-previewto see what it would do.
GJS last edited by
@Gwen-Dragon -- Could you please add tags Bookmarks and Import to this topic, in case anyone is still using tags for search?