Skip to content

Instantly share code, notes, and snippets.

@kaiix
Created April 25, 2018 05:26
Show Gist options
  • Save kaiix/a1927bd23a05ef9bccaa92b0cde8997f to your computer and use it in GitHub Desktop.
Save kaiix/a1927bd23a05ef9bccaa92b0cde8997f to your computer and use it in GitHub Desktop.
import csv
import os
import plistlib
def parse_safari_reading_list_plist():
plist = plistlib.load(
open(os.path.expanduser('~/Library/Safari/Bookmarks.plist'), 'rb'))
items = []
for child in plist['Children']:
if child.get('Title') == 'com.apple.ReadingList':
items = child['Children']
break
return items
with open('readinglist.csv', 'w') as f:
csvfile = csv.writer(f)
csvfile.writerow(['URL', 'Title', 'Selection', 'Folder'])
for item in parse_safari_reading_list_plist():
csvfile.writerow(
[item['URLString'], item['URIDictionary']['title'], '', 'Unread'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment