Solution/Script to automatically sync Safari's Reading List to Read-it-Later services like Pocket or Evernote?

MacOSX contextual menus allow me use Pocket [Formerly Read it later] to archive all, and also read, some of the enormous amounts of content that I come across daily on my browser of choice - Safari.

On iOS [iPad/iPhone] however, the native 'Add to Reading List' feature for Safari is the most tightly integrated option when 'long-clicking' a URL in many different apps, like Mail [all newsletters with links]. This has caused a lot of grief for me as half on my links are saved to the Safari Reading List, and half to a Read-it-later service like Pocket.

Consolidating it in a seamless way when using iOS is a challenge if you wish to avoid opening the webpage in safari first, then clicking a bookmarklet, etc.

Web-based trigger services like 'IFTTT' are only useful when the content has already made its way to Cloud services that it supports, like Pocket, Evernote etc.

One conceptual solution to this problem could be something along the lines of having a script run on my mac that is periodically looking for new items in the 'Reading List' plist file and extracting the url when it sees a new item added [since iCloud syncs iOS and MacOSX Safari]. Perhaps Alfred or some other automator service could then get it to a spreadsheet on the cloud which can then sync with IFTTT and Pocket etc.

Maybe this particular design is not technically feasible or outright wrong, but I would be really grateful if someone with more expertise or nous could suggest an implementation or similar solution.

TL;DR

How can I sync Safari's 'reading list' URLs to Pocket/Evernote etc automagically?


I had this same idea a few months ago. I came up with a solution that works, using Ruby.

I use this gist to parse the Safari Reading List plist file: https://gist.github.com/andphe/3232343

Then I use the ruby Pocket gem to add each item to Pocket.

In the end, I went with Pinboard instead of Pocket, and I have a working project up on github that does exactly that, except using Pinboard.

The example code that you'd benefit from is: https://github.com/prokizzle/pinboard_tools/blob/master/lib/srl_to_pinboard.rb

What you'd ideally do to make it automatic is have Hazel monitor the Safari Reading List plist file for changes, and then run the ruby script if it's recently modified. That way, every item will make it from SRL to your read later service of choice.

Hope that helps.


I use the same bash command as Neglectogram above, but used it within a somewhat primitive script I wrote, which uses Pocket's "add by email" solution as outlined in the other answer to this post. I go in to detail here as there seems to be a demand for a solution to this and such I want even novice users to be able to use this (if it works properly).

My script focuses specifically on Evernote and Pocket as asked, but would work with any service which has the same "email your content in" feature.

The result is as desired, whereby the script:

  • extracts all of the links in the reading list (BUG: takes all bookmarks from Safari, so I temporarly deleted all my bookmarks and just left the reading list, not ideal I know but it works).

  • Iterates over each of these links and sends them to Pocket/Evernote/whatever service individually.

To use the script yourself:

  • Simply open it up in any text editor and replace the email addresses with your Pocket/Evernote account email address depending on which service you want to use and the recipient email addresses with Evernote or Pocket "email in to us" URLs. (Change addresses on lines 11, 13 and 14 to your own).
  • If just using Pocket, you need to send FROM your Pocket account email address TO [email protected]
  • If using Evernote, you can send FROM any of your email addresses TO your specific Evernote Email Adress.

Here is the script I wrote below... (note, I am using Mac OS X, and as such this is a bash script and may not work on other OSs)

#!/bin/bash
# Script to export Safari's reading list into a text file, then import this into Pocket or Evernote (or any service with a "email in content" feature).

# 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
    echo $line
/usr/sbin/sendmail -i -f {{CHANGE THIS insert your pocket account email address here}} {{CHANGE THIS TO EITHER [email protected] OR YOUR EVERNOTE EMAIL ADDRESS}} <<END
Subject: $line
From: {{ CHANGE THIS to your pocket account email if using Pocket, otherwise any of your email accounts will do.}}
To: [email protected] {{ OR IF USING EVERNOTE YOUR EVERNOTE EMAIL ADDRESS}}

$line
END
done < readinglistlinksfromsafari.txt

Above is the template for you to change, and below is the exact script I used, complete with email addresses for Pocket, to act as an example. (On Mavericks, this send to pocket ALL element in Bookmarks.plist, then also Bookmark)

#!/bin/bash
# Script to export Safari's reading list into a text file, then import this into Pocket or Evernote (or any service with a "email in content" feature).

# 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
    echo $line
/usr/sbin/sendmail -i -f [email protected] [email protected] <<END
Subject: $line
From: [email protected]
To: [email protected]

$line
END
done < readinglistlinksfromsafari.txt

I hope this works for you all, and you find it helpful as this is one of my first public scripts etc. Any question just let me know! Here is a link to the GitHub Gist for this also.

https://gist.github.com/arcadia168/0bade46a6bb720395f56

Enjoy!


Also, this link may help a little. It's not perfect but it's an option. http://help.getpocket.com/customer/portal/articles/482759