Thursday, September 04, 2008

Chrome Notes: Bookmarks, where oh where are you?

So like most of you who are probably reading this, I’ve been playing with Google’s new browser, Chrome.

In this post, I’ll not be going into the differences between it and IE, nor comments on its EULA, its cool factor, etc. What I’ll be talking about is some things, some under the hood things, I’ve looked at.

Some background first.

One of the features of IE that I’ve come to rely on is that I can very easily sync my Favorites. This lets me easily, quickly, with no mus of fus, keep my fav’s on three machines all in sync (via Mesh). It’s simple, I don’t have to change my IE usage habits, etc. Sure it’s not very Web 2.0’ish, but that doesn’t matter to me. What I want is to just have my favorites be the same on my machines… Without that, I’m just not a happy web browser camper…

So one of the first things I looked for with Chrome is how I would sync it’s Bookmarks (aka Favorites).

a) Where are the Chrome Bookmarks stored?

The Chrome Bookmarks are stored in a file called “History” (no extension).

On my systems, I found the History file in the following paths:

Vista:
C:\Users\[YourUserName]\AppData\Local\Google\Chrome\User Data\Default\

XP:
C:\Documents and Settings\[YourUserName]\Local Settings\Application Data\Google\Chrome\User Data\Default\

b) What is the History file?

The History file is a SQLite v3 database.

c) Okay, how I can read/open/view the History file

There are a number of SQLite browsing tools available. The one I used, which was the first free one I found, was the SQLite Database Browser. It’s a fast download and can be run without installation…

Once you have a browsing tool, open the History file…

image

d) So where are the Bookmarks?

The magic is the “starred” table. This table is where the bookmarks are stored, what folder they are in, their order, etc.

image

The actual URLs are stored in the “urls” table (funny that… ;)

image

To get at the URL’s for them you join against the “urls” table.

SELECT starred.title, urls.url
FROM starred
INNER JOIN urls ON urls.id = starred.url_id

 

Okay… Now what?

Now what I’m thinking is that I need to write a utility that will export data from the History DB, put it into a file, sync that file (or post the data to a cloud storage area like S3 or SSDS?) and then write a import utility that will slurp in that file/data… Maybe use the starred.Date_Added column to intelligently add new items. But how to track deletes? hum…

Also I need to look around for the Chrome SDK/API/Doc’s etc to see if I’m being a lamer and if there’s a much easier way to sync/import/export bookmarks…  ;)

9 comments:

SÙREN said...

Sir, dat's an amazing research into the chromes DNA.. !
I could not accomplish the task as i didn't understand the last part of the article about joining and filtering the bookmarked urls.. >>

"To get at the URL’s for them you join against the “urls” table.

SELECT starred.title, urls.url
FROM starred
INNER JOIN urls ON urls.id = starred.url_id"

thanks

Gr8 job !

Greg said...

That is some example SQL that can be used in your SQLite utility of choice.

In the one I was using, you would use that SQL on the "Execute SQL" tab...

Anonymous said...

Greg,

I've been linking to your blog in some google help group pages on chrome. Using your research, I was able to find a way to clear the recent bookmarks. I thought you should know.


http://groups.google.com/group/google-chrome-help-how-to/browse_thread/thread/cf66eeb9e36b7e8b/20bbab486f6d2ba7?lnk=gst

Thanks for all the work you put in here.

Greg said...

Very cool... Thanks Neil!

Glad I could help. :)

Avinash said...

Hi Greg.

Thanks for these great tips. I've written a sample program to extract the bookmarks in Java using this information. I've also linked the article on my blog to this one.
http://avinpr.blogspot.com

Cheers.

Greg said...

Nice! Thanks for the link back and for the work (and for releasing the source... :)

It's cool seeing how people are getting at this data...

Anonymous said...

1. Close Chrome
2. Navigate to:
Vista:
"\Users\{user name}\AppData\Local\Google\Chrome\User Data\Default"

or WinXP:
"\Documents and Settings\{user name}\Local Settings\Application Data\Google\Chrome\User Data\Default"

3. Open the 'bookmarks' file (NOT the 'history' file as posted elsewhere) with Notepad (or Notepad2).

4. Within the 'bookmarks' file, locate the bookmarks you want removed - usually near the bottom of the file.

5. Change the "date_added" field to "0" for the entries you want to not show-up. eg:

"other": {
"children": [ {
"date_added": "12866199337156000",
"name": "Open Source Data Mining",
"type": "url",
"url": "http://ubiety.uwaterloo.ca/~tveldhui/teaching/SE362.S2007/notes/18.pdf"
},

6. Click Save

7. Close Notepad

8. Run Chrome and check your Recent Bookmarks.

Thanks to Vasu for his original, but slightly error'ed answer.
:)

dave said...

I also came across this : www.favbrowser.com/backup - free utility will backup all browser settings from all browsers and can then restore when needed. So you could backup the relevant browsers and then copy to the relevant machine.

Anonymous said...

how do I clean multiple chrome bookmarks