Simple Node script that imports them from Chrome into Orion, in case it helps anyone:
import plist from "simple-plist";
import path from 'path';
import os from 'os';
import sqlite3 from 'sqlite3';
import { open } from 'sqlite';
import { v4 as uuidv4 } from 'uuid';
// Enable to console.log converted favourites instead of writing directly to Orion's files
const DEBUG: boolean = false;
const filePath: string = path.join(os.homedir(), 'Library/Application Support/Orion/Defaults/favourites.plist');
const fileContent: { [key: string]: any } = plist.readFileSync(filePath);
(async () => {
// Open the Chrome database
const db = await open({
filename: path.join(os.homedir(), 'Library/Application Support/Google/Chrome/Default/Web Data'),
driver: sqlite3.Database
});
// Query all custom search engines from the keywords table
const results: ChromeKeyword[] = await db.all("SELECT * FROM keywords");
// In Orion, create a new parent folder for Chrome Search Engines
const parentFolderId: string = uuidv4();
const parentFolder: OrionFavourite = {
dateAdded: Date.now(),
id: parentFolderId,
index: 0,
parentId: "0", // This creates a top-level folder under bookmarks
title: "Chrome Search Engines",
type: "folder",
};
fileContent[parentFolderId] = parentFolder;
let indexCounter: number = 1;
// Iterate over each search engine record and create a new Orion Favourite entry
for (const engine of results) {
const newId: string = uuidv4();
const newBookmark: OrionFavourite = {
dateAdded: Date.now(),
id: newId,
index: indexCounter++,
parentId: parentFolderId,
title: engine.short_name,
type: "bookmark",
keyword: engine.keyword,
url: engine.url.replace(/{searchTerms}/g, '%s')
};
fileContent[newId] = newBookmark;
}
// Instead of writing to the output, use DEBUG flag to log the would-be output
if (DEBUG) {
console.log("DEBUG MODE - New favourites content:", fileContent);
} else {
plist.writeFileSync(filePath, fileContent);
console.log("Successfully converted Chrome search engines to Orion bookmarks.");
}
})();
interface ChromeKeyword {
id: number;
short_name: string;
keyword: string;
favicon_url: string;
url: string;
safe_for_autoreplace: number;
originating_url: string;
date_created: number;
usage_count: number;
input_encodings: string;
suggest_url: string;
prepopulate_id: number;
created_by_policy: number;
last_modified: number;
sync_guid: string;
alternate_urls: string;
image_url: string;
search_url_post_params: string;
suggest_url_post_params: string;
image_url_post_params: string;
new_tab_url: string;
last_visited: number;
created_from_play_api: number;
is_active: number;
starter_pack_id: number;
enforced_by_policy: number;
featured_by_policy: number;
url_hash: Buffer;
}
interface OrionFavourite {
dateAdded: number;
id: string;
index: number;
parentId: string;
title: string;
type: 'bookmark' | 'folder';
keyword?: string;
url?: string;
}