#!/usr/bin/python # convert instapaper CSV export to a bookmarks file for import to other things # run as: instapaper-to-bookmarks.py instapaper-export.csv > bookmarks.html import csv import pprint import sys bookmarks = dict() with open(sys.argv[1]) as instapaper_csv_file: instapaper_csv_reader = csv.reader(instapaper_csv_file) headers = instapaper_csv_reader.next() for instapaper_csv in instapaper_csv_reader: # remap bookmark = {headers[i]: instapaper_csv[i] for i in range(0, len(headers))} bookmarks.setdefault(bookmark['Folder'], list()) bookmarks[bookmark['Folder']].append(bookmark) print ''' Bookmarks

Bookmarks

''' for folder in bookmarks: print '

{}

'.format(folder) print '

' for bookmark in bookmarks[folder]: print '

{}'.format(bookmark['URL'], bookmark['Title']) print '

' print ''