This Script Exports Full Bookmark Data to HTML
-
Re: Import/Export ALL Supported Bookmark Properties
I became impatient and wrote a script to do a full export of Vivaldi bookmarks. Based on suggestions in previous threads (@Pathduck), it reads data from a Vivaldi profile's Bookmarks JSON file. Optionally, it also exports icon data from the Favicons SQLite database. The script exports all bookmark properties, including Descriptions, Nicknames (as Firefox Keywords), and Bookmark Toolbar. Here is an example run (on Windows 10):
> 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.
The script also exports Firefox Tags, derived by pattern matching (e.g. commas in a Nickname, or a prefix like '
TAGS:
' in Nickname or Description). I don't use Firefox Tags or Keywords, so these mappings are tentative. If you use different conventions for embedding Tag information in Vivaldi bookmarks, I could probably add them.[Currently this script does not export Bookmark Thumbnails. They make the HTML file larger, and are usually easy to recreate. However, I could add an option without much trouble if anyone needs to export them.]
The script is written in Perl (sorry, but it's the language I knew best when I retired
), with no localization. To run it you need a Perl interpreter and libraries. I use the Windows version of ActivePerl, which includes everything needed. It is also available for Linux and Mac.
Details at Export Vivaldi Bookmarks. I'm not sure where is a good place to make the script available. For now you can download export_vivaldi_bookmarks.zip.
The script is written in Perl (sorry, but it's the language I knew best when I retired
), with no localization. To run it you need a Perl interpreter and libraries. I use the Windows version of ActivePerl, which includes everything needed. It is also available for Linux and Mac.
Details at Export Vivaldi Bookmarks. I'm not sure where is a good place to make the script available. For now you can download export_vivaldi_bookmarks.zip.
-
@GJS That's really great, well done
I ran it in Cygwin Perl (v5.30.3):
$ export 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 - NOTE: Using ICON, not bogus ICON_URI bitmap. export_vivaldi_bookmarks.pl (Hashbang Shell). export_vivaldi_bookmarks.pl - NOTE: Using ICON, not bogus ICON_URI bitmap. export_vivaldi_bookmarks.pl (Convertio β File Converter). export_vivaldi_bookmarks.pl - NOTE: Using ICON, not bogus ICON_URI bitmap. export_vivaldi_bookmarks.pl (Modding Vivaldi | Vivaldi Forum). export_vivaldi_bookmarks.pl - NOTE: Using ICON, not bogus ICON_URI bitmap. export_vivaldi_bookmarks.pl (Subsonic Forum :: Index). export_vivaldi_bookmarks.pl - Exported 739 bookmarks and 70 folders in 1 second. export_vivaldi_bookmarks.pl - 643 with Icon URIs and 647 with Icon Bitmaps. export_vivaldi_bookmarks.pl - 7 with Descriptions and 0 with Tags.
Maybe even the Vivaldi devs can be inspired by this to implement their own full bookmarks data export and import
-
@Gwen-Dragon - If you can make the script portable, that would be great. I would like to incorporate your changes into my master copy, for future maintenance.
I will look into Strawberry Perl. Hopefully the script will be able to run on both Perl interpreters on Windows.
I added a ZIP download link to the document.
-
@Pathduck - Thank you for the compliment (and for the initial clue to the JSON file).
-
Great work!
-
Do I understand it right: The script provides permanent sync of bookmarks to a html-file on every browser-close?
-
@Dancer18 said in This Script Exports Full Bookmark Data to HTML:
Do I understand it right: The script provides permanent sync of bookmarks to a html-file on every browser-close?
Nope - it's a great script but it doesn't perform magic
Maybe in time it can provide an import option as well, but a lot more work to implement in a safe way.
If you run it on browser close, it can provide a good backup with more data than the default export to HTML provides, like nickname and description, that can later be imported manually if needed.
-
@Pathduck So am I right: For normal usage I don't need the script bc of permanent sync of all bookmarks is provided in Vivaldi?
-
@Dancer18 Sure, sync works. But some of us don't trust it 100% so doing regular backups is a good idea
-
@Pathduck I agree!
-
@Gwen-Dragon - Thanks for the version_info suggestions; I have incorporated them into the script. (I haven't seen my Perl Best Practices book for about ten years. I think it's still in a moving carton somewhere.
)
-
@Dancer18 said in This Script Exports Full Bookmark Data to HTML:
Do I understand it right: The script provides permanent sync of bookmarks to a html-file on every browser-close?
@Pathduck replied:
If you run it on browser close, it can provide a good backup with more data than the default export to HTML provides, like nickname and description, that can later be imported manually if needed.
The script is invoked only by command-line. If you want to run it after each Vivaldi exit, you may be able to create a wrapper script which invokes Vivaldi and then invokes
export_vivaldi_bookmarks.pl
. However, making the wrapper script wait until Vivaldi exits can be tricky, depending on the OS and the scripting language.Alternatively, you could schedule a job which runs the script once a day (or oftener), e.g. with Linux '
cron
' or Windows Task Scheduler. You don't have to exit Vivaldi (at least on Windows; I haven't tested on other OSs). The script has an option to log messages to a file, which you must clean up occasionally or it will grow forever. -
@Pathduck said in This Script Exports Full Bookmark Data to HTML:
Maybe in time it can provide an import option as well, but a lot more work to implement in a safe way.
I agree. For starters, the Bookmarks JSON file includes some data which I don't know how to generate, such as an overall checksum, and a GUID for each added folder and bookmark. Furthermore, ID numbers suggest that there is some bookmark data in SQLite files, which I think it would be unwise for an external script to modify.
I am mulling over some ideas for copying Descriptions and Nicknames from an HTML file into existing bookmarks which were imported previously by Vivaldi (and perhaps even reorganized afterward). If that is possible, it could be done in a copy of just the Bookmarks JSON file.
Anyway, I won't get to this very soon; I need to take a break and catch up on some other things.
-
@Gwen-Dragon - Thanks for the module suggestions, I will look into them. The existing code comes from my script template, which has history.
When I started writing scripts there was no Getopt, and I never got around to updating my script templates. It looks useful, though.
There have been occasions when I needed to reference a script's name and/or path from within a BEGIN block. While it is possible to import a module there using a couple of lines, it seemed desirable to keep the BEGIN block simple and not mess with the standard import sequence. So the code to set those variables also remains in my template. The regex pattern is such a great example of Perl's obscure conciseness that I hate to abandon it
. However, clarity is probably better for a public script.
-
I uploaded
export_vivaldi_bookmarks.pl
version 1.20 (Download, User Guide). Changes include:- Converted to
FindBin
to get script's name and directory. - Converted to
Getopt::Long
to read command-line options. The -debug options are now slightly different. - Added '
use warnings
', and fixed the warnings. - Added export of folder Descriptions, Nicknames, and Tags. Firefox does not import folder Descriptions or Nicknames, but they are included for those who use the HTML file as a bookmarks backup.
- Converted to
-
@Gwen-Dragon It is really a very necessary and critical function.
If vivaldi knew that only 1% of the 99% really comes here to tell you that the business isnβt working,
and also realize that a very complete bookmark system is important, I would appreciate this guy, who did the job.
And it is more than fundamental to implement the import (CORRECT) of all browsers on your platform. Especially firefox, which is the most complete of all in Bookmark. While Google, Brave, Edge worsens and undoes resources.
There are many researchers, scholars who use firefox just because of this bookrmak, like me. And until today I have not immigrated to Vivaldi because he simply destroyed 10 years of work in cataloging bookrmak, which is very detailed. I use TAGS a lot to find the data. I made it a URLS library. I've had over 18,000 urls. I don't have all of that anymore, because those that were disabled were removed.
And it would be very important to see the opportunity to (deliver more) than all browsers, building the best BOOKMARK system of all, which today is led by FIREFOX.
And vivaldi has a full plate to do better.
1- Import all browsers.
2- Offer the best bookmark management experience.
3- And I still have an idea (to make this a special product) innovating the system. (**** cell to Whats or Telegram). I put myself at your disposal, because I work with Interface for over 25 years.Since it says that the little brother's script is ugly. And they are sinning ugly when importing Mr. Moderator.
modedit removed phone number
-
@mateusresende - I think the term 'ugly' was specifically in reference to statements such as
($scriptdir, $scriptname) = (__FILE__ =~ m|(.*?)[/\]?([^/\]+)$|);
. I'll be the first to admit that my Perl style is very early 21st century, so constructive suggestions are welcome. The recommendations in this thread have helped to make the script better.Just before Firefox dropped the feature, I saved an HTML bookmarks file with more than 900 Descriptions. If you have such a file, then there is hope for importing the Descriptions into Vivaldi.
-
@Gwen-Dragon said in This Script Exports Full Bookmark Data to HTML:
And they are sinning ugly when importing Mr. Moderator.
Wut? OK. Tell Mister Moderator what his sin would be.
For me this is 0% relevant as i am not a Mister. :face_with_stuck-out_tongue:LOL
-
@Gwen-Dragon ahm sorry.
I have translated by google translator.
Because the translation doesn't come out faithfully. I'm Brazilian, I was born deaf, in addition to having a lot of difficulty speaking Portuguese, I feel happy to be able to communicate with the world.sorry for my writing, i try to do the best.
-
@GJS Thanks for your effort.. exactly what I was looking for...