Main /
ReadingList
I read news etc on my iPad, finding things to track and investigate on a computer later.
I don't use safari on my (hack)-intosh, so the reading-list on the iPad never occurred to me. Until today. I put the things I like in the reading list, and then move them out later.
Rob Mathers created a python script to dump the reading list!
From this thread on StackExchange
#!/usr/bin/env python
import plistlib
from shutil import copy
import subprocess
import os
from tempfile import gettempdir
import sys
import atexit
BOOKMARKS_PLIST = '~/Library/Safari/Bookmarks.plist'
bookmarksFile = os.path.expanduser(BOOKMARKS_PLIST)
# Make a copy of the bookmarks and convert it from a binary plist to text
tempDirectory = gettempdir()
copy(bookmarksFile, tempDirectory)
bookmarksFileCopy = os.path.join(tempDirectory, os.path.basename(bookmarksFile))
def removeTempFile():
os.remove(bookmarksFileCopy)
atexit.register(removeTempFile) # Delete the temp file when the script finishes
converted = subprocess.call(['plutil', '-convert', 'xml1', bookmarksFileCopy])
if converted != 0:
print "Couldn't convert bookmarks plist from xml format"
sys.exit(converted)
plist = plistlib.readPlist(bookmarksFileCopy)
# There should only be one Reading List item, so take the first one
readingList = [item for item in plist['Children'] if 'Title' in item and item['Title'] == 'com.apple.ReadingList'][0]
if 'Children' in readingList:
for item in readingList['Children']:
print item['URLString']
and wonder-of-wonders, a Factor version was also posted (forth-like language)!!!
: reading-list ( -- urls )
"~/Library/Safari/Bookmarks.plist" read-plist
"Children" of [ "Title" of "com.apple.ReadingList" = ] find nip
"Children" of [ "URLString" of ] map ;
See https://re-factor.blogspot.com/2013/07/reading-list.html for details.