brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.68k stars 2.31k forks source link

Add ability to import custom user-defined search engine keywords from Chrome #6959

Open stephthegeek opened 4 years ago

stephthegeek commented 4 years ago

Per this forum thread, adding a feature request to be able to import custom user-defined search engine keywords from Chrome: https://community.brave.com/t/migrate-search-engines-from-another-browser/58223/7

I also have many dozens of these shortcuts set up, and as something I rely on often for quick keyboard nav, it's currently a roadblock to giving Brave a solid audition.

They're in an SQLite file, details here: https://superuser.com/questions/272511/where-do-chrome-chromium-store-search-keywords

Thanks!

abjugard commented 3 years ago

I have almost 100 such custom search engines with associated keywords. Few browsers support this functionality as well as Chromium, and even if they do, migrating it all manually is a headache I'm not interested in exploring. It's literally what is keeping me from leaving Google Chrome.

Thanks for the tip with the SQLite file, assuming Braves database is similar I should be able to use that information to make the transition.

Making this comment to highlight that this functionality might be a gatekeeper for some people.

Redsandro commented 3 years ago
sqlite3 "/home/username/.config/google-chrome/Default/Web Data" ".dump keywords" > search-engines.sql
sqlite3 "/home/username/.config/BraveSoftware/Brave-Browser/Default/Web Data" "DROP TABLE keywords"
cat search-engines.sql | sqlite3 "/home/username/.config/BraveSoftware/Brave-Browser/Default/Web Data"
LeuschkeTressa commented 3 years ago
sqlite3 "/home/username/.config/google-chrome/Default/Web Data" ".dump keywords" > search-engines.sql
sqlite3 "/home/username/.config/BraveSoftware/Brave-Browser/Default/Web Data" "DROP TABLE keywords"
cat chrome-search-engines.sql | sqlite3 "/home/username/.config/BraveSoftware/Brave-Browser/Default/Web Data"

Great with a workaround, thanks.

However there seems to be a typo in the sql file filename, I believe it should be (e.g.):

sqlite3 "/home/username/.config/google-chrome/Default/Web Data" ".dump keywords" > search-engines.sql
sqlite3 "/home/username/.config/BraveSoftware/Brave-Browser/Default/Web Data" "DROP TABLE keywords"
cat search-engines.sql | sqlite3 "/home/username/.config/BraveSoftware/Brave-Browser/Default/Web Data"

on macOS, use:

sqlite3 "/home/username/Library/Application Support/Google/Chrome/Default/Web Data" ".dump keywords" > search-engines.sql
sqlite3 "/home/username/Library/Application Support/BraveSoftware/Brave-Browser/Default/Web Data" "DROP TABLE keywords"
cat search-engines.sql | sqlite3 "/home/username/Library/Application Support/BraveSoftware/Brave-Browser/Default/Web Data"

This worked fine for me.

Redsandro commented 3 years ago

However there seems to be a typo in the sql file filename, I believe it should be (e.g.):

Yes, you are correct. Good find. :+1: I corrected it in my comment above.

nachocab commented 2 years ago

I can confirm this works on macOS:

# 1. Make sure you quit Chrome and Brave before running this
# 2. Make sure you replace YOUR_USERNAME for your own username
# 3. Run this in the command line and open Brave to test it
sqlite3 "/Users/YOUR_USERNAME/Library/Application Support/Google/Chrome/Default/Web Data"  ".dump keywords" > chrome-search-engines.sql
sqlite3 "/Users/YOUR_USERNAME/Library/Application Support/BraveSoftware/Brave-Browser/Default/Web Data"  "DROP TABLE keywords"
cat chrome-search-engines.sql| sqlite3 "/Users/YOUR_USERNAME/Library/Application Support/BraveSoftware/Brave-Browser/Default/Web Data"
Ostii commented 2 years ago

@nachocab I'm trying to copy Search Engine data from Brave Nightly to Brave but not having much luck. Unfortunately I can't sync as the sync functionality is broken for me on Nightly.

I've tried the script above updating the user name, and updating the fort line to: sqlite3 "/Users/ostii/Library/Application Support/BraveSoftware/Brave-Browser-Nightly/Default/Web Data" ".dump keywords" > chrome-search-engines.sql

And also tried updating with he same above except changing chrome-search-engines.sql to brave-search-engines.sql but neither worked.

Do you know what the SQL file is named for search engines in Brave?

nachocab commented 2 years ago

@Ostii It doesn't matter what name you give to the file. Just make sure it's not empty.

Also, update the URL paths for the last 2 commands.

The flow is

  1. Export your data from Brave nightly to a file
  2. Drop the table in regular Brave
  3. Import the file to regular Brave
appel commented 1 year ago

Thanks to the excellent answer by @Redsandro I was able to do this on Windows, which I'll document below because my future self will inevitably find this via Google a few years from now.

First I downloaded sqlite3.exe, which you can find under the "Precompiled Binaries for Windows" section at https://www.sqlite.org/download.html. At the time of writing I downloaded sqlite-tools-win32-x86-3390400.zip. I then extracted it and placed it in the root, so the full path was C:\sqlite-tools-win32-x86-3390400.

Then I opened PowerShell, navigated to the new sqlite-tools-win32-x86-3390400 folder, and ran the following commands. Make sure you change for your system's username. Also make sure all browsers are fully closed.

Here's how you do it with Chrome on Windows:

.\sqlite3.exe 'C:\Users\<USERNAME>\AppData\Local\Google\Chrome\User Data\Default\Web Data' ".dump keywords" > search-engines.sql
.\sqlite3.exe 'C:\Users\<USERNAME>\AppData\Local\BraveSoftware\Brave-Browser\User Data\Default\Web Data' "DROP TABLE keywords"
cat search-engines.sql | .\sqlite3.exe 'C:\Users\<USERNAME>\AppData\Local\BraveSoftware\Brave-Browser\User Data\Default\Web Data'

If Edge is your browser it's pretty much the same thing:

.\sqlite3.exe 'C:\Users\<USERNAME>\AppData\Local\Microsoft\Edge\User Data\Default\Web Data' ".dump keywords" > search-engines.sql
.\sqlite3.exe 'C:\Users\<USERNAME>\AppData\Local\BraveSoftware\Brave-Browser\User Data\Default\Web Data' "DROP TABLE keywords"
cat search-engines.sql | .\sqlite3.exe 'C:\Users\<USERNAME>\AppData\Local\BraveSoftware\Brave-Browser\User Data\Default\Web Data'

Hope this helps someone else (or future me).

abjugard commented 1 year ago

We shouldn't have to still do it this way though. Come on @brave-dev, this is a blocker for many people, it deserves to be migrated when importing from Chrome!

MidnightJava commented 1 year ago

Thanks, @Redsandro, for the workaround. Here are the commands to use on ubuntu:

sqlite3 "/home/USERNAME/.config/google-chrome/Default/Web Data" ".dump keywords" > chrome-search-engines.sql sqlite3 "/home/USERNAME/.config/BraveSoftware/Brave-Browser/Default/Web Data" "DROP TABLE keywords" cat chrome-search-engines.sql| sqlite3 "/home/USERNAME/.config/BraveSoftware/Brave-Browser/Default/Web Data"