Extract Mail.app RSS Feeds URL 2


Extract Mail.app RSS Feeds URL


I use Mail for my RSS feed reader. Its free, built in and does the job I want it to. But there is one problem with Mail. There is no way to export the list for backup and future use. What happens if Mail crashes in some mysterious way. You would lose all of the URL’s. You could go back and try to add them all, but you will end up missing some. This simple Terminal script which I have found, solves this problem.

To run this script simply open up Terminal and copy and paste the following.

IFS=$'\n';for i in $(find ~/Library/Mail/RSS/ -name "Info.plist");do grep "<string>http://" $i | sed "s/.*\(http[^<]*\).*/\1/";done

What this does is go through ~/Library/Mail/RSS and then through each sub folder, looks through the folder for a Info.plist file and then extracts the URL. It will then continue to do this until it has gone through every folder. It will then output the URL’s in the Terminal window.

The one problem with this script is that it only outputs the URL’s in Terminal. You can add a little bit of code to the end so it will output this code to a file. Simply use the following instead.

IFS=$'\n';for i in $(find ~/Library/Mail/RSS/ -name "Info.plist");do grep "<string>http://" $i | sed "s/.*\(http[^<]*\).*/\1/";done >> rss.txt

Simply change rss.txt to any name and location you want. It will put the file in your home folder unless you specify a different location.

A very nifty little script that is a good way to backup your RSS feed list if anything goes wrong.

Update: Having looked into this a bit more you can use the following which is a lot quicker code wise.
pubsub --client com.apple.mail list | cut -f3 | sed -ne '3,$p'

You can once again add >> rss.txt, if you want to export these URLS to a file.

If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.

Where To Next?

  • Subscribe To Mac Tricks And Tips