Skip to content

Instantly share code, notes, and snippets.

@johnybradshaw
Forked from erineland/exportsafarireadinglist.sh
Last active December 15, 2015 10:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnybradshaw/8515f25e039cc03a4f0c to your computer and use it in GitHub Desktop.
Save johnybradshaw/8515f25e039cc03a4f0c to your computer and use it in GitHub Desktop.
Export Safari's Reading List to Pocket/Evernote (or any service with an "email content in" feature)
I had issues getting this to run on OSX, updated to add an additional line break after the email address.
Also changed the subject to a generic term as complex URLs was borking it.
#!/bin/bash
# Script to export Safari's reading list into a text file and email the individual links
# First take all of Safari's Reading List items and place them in a text file.
/usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o '<string>http[s]{0,1}://.*</string>' | grep -v icloud | sed -E 's/<\/{0,1}string>//g' > readinglistlinksfromsafari.txt
# Now loop over each of those URls within that text file and add them to pocket.
while IFS= read -r line
do
/usr/sbin/sendmail -i -f myaddress@link.com add@getpocket.com <<END
Subject: Link
From: myemail@gmail.com
To: add@getpocket.com
$line
END
done < readinglistlinksfromsafari.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment