Skip to content

Instantly share code, notes, and snippets.

@davidrothera
Created November 20, 2015 15:43
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 davidrothera/95e079089f4e3c5bb37d to your computer and use it in GitHub Desktop.
Save davidrothera/95e079089f4e3c5bb37d to your computer and use it in GitHub Desktop.
Send Safari bookmarks to Pocket
#!/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 david.rothera@gmail.com add@getpocket.com <<END
Subject: Links
From: david.rothera@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