Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Export manualy your google bookmarks and transform it to markdown format for hosting and versioning on github (quick and dirty)
# First export manualy your google bookmarks in place exported file in the same directory of this script
# After launch this script (python google-bookmarks-to-markdown-format.py) and have fun !
def run():
output = []
with open('GoogleBookmarks.html') as export:
html = export.readlines()
for line in html:
if 'H3' in line:
output.append('## {0}'.format(line[36:-6].capitalize()))
if 'A HREF' in line:
data = line.split()
link = data[1].replace('HREF="', '').replace('"', '')
text = line.replace(link, '')[43:-5].capitalize()
output.append('- [{0}]({1})'.format(text, link))
print(output)
with open('bookmarks.md', 'w+') as markdown:
markdown.write('\n'.join(output))
if __name__ == "__main__":
run()
@4383

This comment has been minimized.

Copy link
Owner Author

commented Dec 2, 2016

This is a quick and dirtty script for transform your google bookmarks on an file at markdown format.
After you can host it on github for beneficiate of versioning system and also of the gh-pages hosting.
Exemple of result (with my personal bookmarks)

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.