Created
December 2, 2016 15:33
-
-
Save 4383/1ccd5efe6d84d140da6c56689ac64a1e to your computer and use it in GitHub Desktop.
Export manualy your google bookmarks and transform it to markdown format for hosting and versioning on github (quick and dirty)
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
# 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() |
I found another way to do this: copy HTML page, and paste in typora.
Typora is a great markdown editor that converts HTML to markdown when pasting and keeps most styles. 😄
This one does the job nicely: https://github.com/yannickperrenet/bookmarkdown
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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)