Skip to content

Instantly share code, notes, and snippets.

@encima
Created May 27, 2023 08:15
Show Gist options
  • Save encima/5066beb4fe1f6734b95df846ec73f88e to your computer and use it in GitHub Desktop.
Save encima/5066beb4fe1f6734b95df846ec73f88e to your computer and use it in GitHub Desktop.
Convert bookmarks exported from tefter.io from JSON to Netscape HTML format
import json
data = json.load(open('bookmarks.json','r'))
html = """
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!--This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<Title>Bookmarks</Title>
<H1>Bookmarks</H1>
<DL><p>
"""
for row in data:
html += f' <DT><A HREF="{row["url"]}" ADD_DATE="1618769696" LAST_MODIFIED="1618769696">{row["title"]}</A>\n'
html += "</DL><p>"
with open('tefter_converted.html', 'w') as f:
f.write(html)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment