Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

logic behind creating bookmark checksum in google chrome

How i can add a new bookmark entry in chrome bookmarkfile?. My requirement is, i need to add a bookmark entry through my application. Please specify the logic behind creating checksum(MD5).

like image 319
KKSB Avatar asked Jul 03 '12 10:07

KKSB


People also ask

What is the purpose of the bookmarks bar?

The bookmarks bar contains all your bookmarks and bookmark folders created in Google Chrome. You can dock the bar directly underneath the address bar at the top of the browser window for easy access to your favorite sites. Click the Chrome menu Chrome menu on the browser toolbar.

How do I see when a Chrome bookmark was taken?

Yes. Open the Bookmarks file in your profile directory, locate the bookmark in question and see the "date_added". Then convert the timestamp to time&date.

Why do my bookmarks multiply in Chrome?

Why do my Chrome bookmarks keep duplicating? This is generally due to a conflicting extension installed on the computer. Some users found that it was the iCloud Bookmarks Chrome extension that caused the problem. So if you have it installed, remove it right away and the problem should be fixed.

What is manage bookmarks in chrome?

Manage bookmarks For administrators who manage Chrome browser or Chrome OS devices for a business or school. As an admin, you can create and organize managed bookmarks to give users quick access to web resources when they're signed in to Chrome. The webpages that you add appear in a folder on their bookmarks bar. Add or edit bookmarks

How to back up Google Chrome bookmarks?

There’s a bookmarks bar, the “Other Bookmarks” folder, and a sidebar. The bookmarks are also stored in a folder on your Windows PC or Mac. These bookmark files can be helpful to have for backing up Chrome. If you don’t want to rely on Chrome’s cloud sync features, you can use the bookmarks file as a local backup and use it to restore the bookmarks.

Where are Google Chrome bookmarks stored?

Google Chrome can keep your bookmarks in a few different places. There’s a bookmarks bar, the “Other Bookmarks” folder, and a sidebar. The bookmarks are also stored in a folder on your Windows PC or Mac. These bookmark files can be helpful to have for backing up Chrome.

How do I change the Order of my bookmarks in chrome?

Reorder bookmarks and folders You can reorder folders and bookmarks to change the order in which they appear. Sign into your Google Admin console. Sign in using your administrator account(does notend in @gmail.com). From the Admin console Home page, go to DevicesChrome.


2 Answers

Regardless of the safety/hackishness of doing it, here's how:

  1. Make sure Chrome is closed.
  2. Delete (or rename) Bookmarks.bak
  3. Remove the checksum entry entirely from Bookmarks
  4. Edit the Bookmarks JSON to your hearts content
  5. Reopen Chrome

When presented with no backups and no checksum, Chrome will use the new JSON and generate a new checksum.

If you would like to do this more seamlessly / less aggressively, you can just look at how they generate the checksum in the original source code and implement the same algorithm (see here, on line 57).

Of course, keep in mind that Google can change things that could break compatibility. However, this does work, I just did it in a Java app I wrote.

like image 160
krispy Avatar answered Oct 01 '22 13:10

krispy


Obviously this is hackish and only meant for people who know what they are doing, but, since Chrome Mobile does not let the user export/import their own bookmarks (not exactly user-friendly!), sometimes there's no choice - imagine having to clean up a Bookmarks file with thousands of entries by hand.

Anyway, here's a working Python implementation:

roots = ['bookmark_bar', 'other', 'synced']

def checksum_bookmarks(bookmarks):
    md5 = hashlib.md5()

    def checksum_node(node):
        md5.update(node['id'].encode())
        md5.update(node['name'].encode('utf-16le'))
        if node['type'] == 'url':
            md5.update(b'url')
            md5.update(node['url'].encode())
        else:
            md5.update(b'folder')
            if 'children' in node:
                for c in node['children']:
                    checksum_node(c)

    for root in roots:
        checksum_node(bookmarks['roots'][root])
    return md5.hexdigest()

As long as you're only adding bookmarks, you're probably fine, but for anything more complex (e.g. doing major cleanups, editing and deleting bookmarks, especially when multiple devices are involved), be sure to reset "Chrome Sync", or it will give you back all the deleted stuff, and an extra copy of each altered bookmark: Settings -> Sync -> Manage synced data -> Reset Sync

like image 43
wildekat Avatar answered Oct 01 '22 13:10

wildekat