Created
May 7, 2011 12:36
-
-
Save pelletier/960459 to your computer and use it in GitHub Desktop.
Import your Google Chrome booksmarks to readitlaterlist.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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