I've just started writing chrome extensions . Now i've hit a block . I understand that all the chrome data is stored in a SQLite database called WEB DATA.
Now based on some input in the omnibar , i need to insert a few records to a table in this WEB DATA .
Do you know how this can be done programatically when chrome is open ? Because we can go to options -> Manage search engines -> and add a new search engine to the bottom . How does chrome do this behind the scenes ?
Thanks in advance!
Download and extract sqlite-tools-win32-x86-3240000.zip.
First, add the the Search Provider from within Google Chrome:
Open an Windows Command Prompt (cmd.exe). Type the following command:
sqlite3.exe "%LOCALAPPDATA\Google\Chrome\User Data\Default\Web Data"
(whereas "web Data" is the actual sqlite-database file)
The file is opened with sqlite. Now type the following command to export the search engines to a .CSV-file:
sqlite> .headers on
sqlite> .mode csv
sqlite> .output C:/keywords_table.csv
sqlite> SELECT * FROM keywords;
sqlite> .quit
Open the the .CSV-file and notice the last line: 6,DuckDuckGo,duckduckgo.com,https://duckduckgo.com/favicon.ico,https://duckduckgo.com/?q={searchTerms},0,"",13173455944766115,0,"","",0,0,13173455944766115,2bb9a9bf-8921-421a-89b4-06deeaaf0742,[],"","","","","",0
Use the information from the .CSV-file to add the new search engine to Google Chrome (again from Windows Command Prompt):
sqlite3.exe "%LOCALAPPDATA%\Google\Chrome\continuousUpdates\User Data\Default\Web Data" "INSERT INTO keywords VALUES(6,'DuckDuckGo','duckduckgo.com','https://duckduckgo.com/favicon.ico','https://duckduckgo.com/?q={searchTerms}',0,'',13173455944766115,0,'','',0,0,13173455944766115,'2bb9a9bf-8921-421a-89b4-06deeaaf0742','[]','','','','','',0);"
Notice that I have replaces all double quotes with single qoutes and places all string-values within single qoutes as well.
Start Google Chrome and check "chrome://settings/searchEngines" if the new search engine appears in the list "Default search engines" or "Other search engines"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With