Skip to content

Instantly share code, notes, and snippets.

@abruzzi
Created March 7, 2014 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abruzzi/9407094 to your computer and use it in GitHub Desktop.
Save abruzzi/9407094 to your computer and use it in GitHub Desktop.
visualize your data

Download you google bookmarks to file, in HTML format.

open it in browser, you need jQuery of course:

var jq = document.createElement('script');
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);

and then

var a = $('dl dt a');

var x = $.map(a, function(item) { 
	return { title: $(item).text(), created: $(item).attr('add_date'), link: $(item).attr('href')} 
});

$.each(x, function(index, value){ 
	localStorage.setItem(index, JSON.stringify(value))
});

this step will save all the information to locaStorage, which is internally a sqlite database, the database in my Win 7 was:

C:\Users\qwx204902\AppData\Local\Google\Chrome\User Data\Default\Local Storage\__0.localstorage

and I use sqlite3 client to open it:

nastar@ubuntu:~$ sqlite3 __0.localstorage
SQLite version 3.7.15.2 2013-01-09 11:53:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .schema
CREATE TABLE ItemTable (key TEXT UNIQUE ON CONFLICT REPLACE, value BLOB NOT NULL ON CONFLICT FAIL);
sqlite> select count(distinct value) from ItemTable;
6502

And then we can use it as datasource, and use D3.js or something to try to analyze it and visualize it in some format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment