Import Safari bookmarks into Instapaper

Import Safari bookmarks into Instapaper

I recently switched from Pocket to Instapaper and thought it would be nice to also have my Safari bookmarks in Instapaper. This is how I did it:

  1. First convert the Safari bookmarks file 'Bookmarks.plist' to XML: /usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist > Bookmarks.xml

  2. Then, using XPath, extract all the URLs and titles from the generate XML file: //key[.="URIDictionary"]/../dict/key[.="title"]/../string/text()|//key[.="URLString"]/../string[contains(text(),'http')]/text()

  3. Save the result (you should have a list with the following repeating pattern: Title URL ...) into a text file (e.g. url_titles.txt).

  4. Script to generate pocket export html from list of titles and urls: -- convert.sh -- while read f; do read s echo "

  5. "$f"
  6. " done
  7. Generate Pocket-compatible export HTML file: convert.sh > exported.html

  8. Finally, in Instapaper settings choose import from Pocket and select 'exported.html'

Posted on Aug 14
Written by Luís Marques Silva