How to Export Safari Reading List Items
Today I found a need to export my Safari reading list to import them to a local archive. Building on a Python script I found that was dated and defunct, I cleaned it up a bit to get it into working order for Python 3. Hopefully this helps someone save some time, including my future self.
#!/usr/bin/env python3 import os import plistlib relpath = 'Library/Safari/Bookmarks.plist' fullpath = os.path.join(os.environ['HOME'], relpath) with open(fullpath, 'rb') as fp: plist = plistlib.load(fp) for child in plist['Children']: if child.get('Title', None) == 'com.apple.ReadingList': bookmarks = child['Children'] urls = (bookmark['URLString'] for bookmark in bookmarks) print('\n'.join(urls))