Export Vivaldi Bookmarks

Installation      Usage      Export Options      Review/Debug Options      Firefox TAGS

Script export_vivaldi_bookmarks.pl exports a Vivaldi Bookmarks file (JSON format) to Firefox HTML export format.  It includes properties omitted by Vivaldi's Bookmark Export, including Descriptions, Nicknames, and Bookmark Toolbar attributes.  It supports some conventions for deriving Firefox TAGS from Nicknames and Descriptions (see Firefox TAGS below). 

Installation

Download export_vivaldi_bookmarks.zip, which contains the script, library, and this document.  Unzip the file in a directory of your choice.  If the directory is on your PATH, then the script will be easier to invoke.

To run the script you will need a Perl interpreter and libraries.  ActivePerl includes everything needed, and is available for Windows, Linux, and Mac.

Usage

Synopsis:
   Exports Vivaldi browser bookmarks to Firefox bookmarks HTML format, including
   properties omitted by Vivaldi's Bookmark Export (descriptions, nicknames, and
   Bookmark Toolbar attributes).

Usage:
   [Perl [-S]]  export_vivaldi_bookmarks.pl  [options]  <profile>/Bookmarks

Options (One or two dashes.  Names may be abbreviated):
  -icons      Includes ICONs (in-line data).
  -uris       Includes ICON_URIs (references).
  -comments   Adds HTML comments showing folder/bookmark structure.
  -preview    Adds icons to bookmarks for view in browser (not importable).
  -quiet      Supresses progress messages & notes, but not errors & warnings.
  -help       Prints this usage message.
  -version    Prints version information.
  -log <file> Logs messages to <file>.
  -debug [1]  Includes debug output (not importable).
  -debug 2|3  Includes more debug output (not importable).

Arguments:
   <profile>/Bookmarks      'Bookmarks' file (JSON data) in a Vivaldi profile.

Example (Windows):

> set BOOKMARKS="%LOCALAPPDATA%\Vivaldi\User Data\Default\Bookmarks"
> perl -S  export_vivaldi_bookmarks.pl  -icons -uris  %BOOKMARKS%  > exported.html

export_vivaldi_bookmarks.pl - Reading JSON Bookmarks ...
export_vivaldi_bookmarks.pl - Reading Favicons Database ...
export_vivaldi_bookmarks.pl - Writing HTML Bookmarks ...
export_vivaldi_bookmarks.pl - Exported 13,748 bookmarks and 2,808 folders in 6 seconds.
export_vivaldi_bookmarks.pl -   5,345 with Icon URIs and 1,923 with Icon Bitmaps.
export_vivaldi_bookmarks.pl -   75 with Descriptions and 13 with Tags.

Export Options

Command-line options may be specified using one or two dashes, and may be abbreviated to any unique prefix.  For example, -i , --I, --icons, and -IC are all equivalent.

A Vivaldi bookmark may have an in-line icon (data), an icon URI (external reference), both, or neither.  Vivaldi stores icon information in the Favicons database in a Vivaldi profile.  By default, neither icon is exported to the HTML.  After import a web browser typically fills in an icon the first time it opens the page.  However, that can be inconvenient if the number of bookmarks is large.

In rare cases these options may cause an SQLite database error message.  It may be a timing problem, so try again.  If the error persists it may be a caching problem, so exit from all Vivaldi profiles and try again.  If that doesn't help, the Bookmarks database may be corrupted, or its structure may have changed since this script was written.

Review and Debugging Options

   <!-- CRB | Classical 99.5 -->
        <!--    | WCRB Classical 99.5 -->
        <!--    | Tags = WCRB, FM, Radio, PBS -->
        <!--    | TV stations are WGBH (2) and WGBX (44) -->
        <!--    SHORTCUT: wcrb -->
        <!--    TAGS: WCRB,FM,Radio,PBS -->
        <DT><A HREF="https://www.classicalwcrb.org/#stream/0" ADD_DATE="1611270868" SHORTCUTURL="wcrb" TAGS="WCRB,FM,Radio,PBS">CRB | Classical 99.5</A>
            <DD>WCRB Classical 99.5
Tags = WCRB, FM, Radio, PBS
TV stations are WGBH (2) and WGBX (44)

Firefox TAGS

Vivaldi bookmarks do not support TAGS, but you can enter them into the Nickname or Description fields by following some conventions.  This script exports most Nicknames as Firefox Keywords (SHORTCUTURL).  However, it extracts TAGS from:

If both Nickname and Description contain tags, then the output includes all of them.

These conventions are tentative.  The script could incorporate other conventions without too much trouble.

Examples:

In Vivaldi Bookmark                          In Exported HTML
---------------------------------------      --------------------------
Nickname
:    @whrb                       
  SHORTCUTURL="@whrb"     
Description: Harvard University Radio         (No TAGS)

Nickname:    WBUR, FM, Radio, NPR        
  TAGS="WBUR,FM,Radio,NPR"
Description: Boston University Radio.         (No SHORTCUTURL)

Nickname:    TAGS: WFCR, FM, Radio, NEPM 
  TAGS="WFCR,FM,Radio,NEPM"
Description: Five College Radio               (No SHORTCUTURL)

Nickname:    @wcrb                       
  SHORTCUTURL="@wcrb"
Description: WCRB Classical 99.5
             Tags = WCRB, FM, Radio, PBS  ➜  TAGS="WCRB,FM,Radio,PBS"
             TV stations are WGBH and WGBX