Created
April 25, 2018 05:26
-
-
Save kaiix/a1927bd23a05ef9bccaa92b0cde8997f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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