Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
convert bookmark json used by Chrome on Android to pairs of url and name (this pair is used as bookmark on qutebrowser)
#!/bin/env python
import sys
import json
def print_url_and_name_pair(info_list):
for entry in info_list:
if "url" in list(entry.keys()):
print("%s %s" % (entry["url"], entry["name"]))
else:
print('\n')
print_url_and_name_pair(entry["children"])
if __name__ == "__main__":
with open(sys.argv[1]) as f:
bookmark = json.loads(f.read())
info_list = bookmark["roots"]["bookmark_bar"]["children"]
print_url_and_name_pair(info_list)
info_list = bookmark["roots"]["other"]["children"]
print_url_and_name_pair(info_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.