Skip to content

Instantly share code, notes, and snippets.

@pelletier
Created May 7, 2011 12:36
Show Gist options
  • Save pelletier/960459 to your computer and use it in GitHub Desktop.
Save pelletier/960459 to your computer and use it in GitHub Desktop.
Import your Google Chrome booksmarks to readitlaterlist.com
import json
import urllib
import httplib
KEY = "AAA"
USER = "BBB"
PASS = "CCC"
PATH = "/Users/thomas/Library/Application Support/Chromium/Default/Bookmarks"
content = open(PATH, 'r').read()
data = json.loads(content)
def get_underlying_children(data):
children = []
if data.__class__ == dict:
if "children" in data.keys():
children.extend(get_underlying_children(data['children']))
else:
children.append(data)
if data.__class__ == list:
for item in data:
children.extend(get_underlying_children(item))
return children
children = []
for root, root_value in data['roots'].iteritems():
children.extend(get_underlying_children(root_value))
for fav in children:
conn = httplib.HTTPSConnection("readitlaterlist.com")
url = fav['url'].encode('utf-8')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment