Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.5: Export Mail.app's RSS feed URLs in Terminal UNIX
As I wanted to pass my newsfeeds from Mail.app to a friend I realized that there is no "Export RSS-feeds to ..." button in Mail.app. So I wrote this little workaround to export them in Terminal (assuming the bash default shell): This exports all URLs from your Mail.app RSS directory directly into the shell. I could then easily pass this list to my friend. As an additional option, here is a little modification to open all feed URLs in the default web browser: This opens your feeds in the browser with a feed://... URL. Then you can easily add them to your bookmarks bar, or can do something other with them. Note that you may add && sleep 60 after the last bracket if you have lots of feeds in Mail.app.
    •    
  • Currently 3.50 / 5
  You rated: 3 / 5 (12 votes cast)
 
[25,083 views]  

10.5: Export Mail.app's RSS feed URLs in Terminal | 11 comments | Create New Account
Click here to return to the '10.5: Export Mail.app's RSS feed URLs in Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Export Mail.app's RSS feed URLs in Terminal
Authored by: JaxMyers on Mar 26, '08 08:13:42AM

Thanks for the hint. I was trying to figure out how to do this the other day...



[ Reply to This | # ]
10.5: Export Mail.app's RSS feed URLs in Terminal
Authored by: chleuasme on Mar 26, '08 10:49:48PM
You can simply use defaults ;-)
for i in ~/Library/Mail/RSS/*/Info.plist
do
    defaults read "${i%.plist}" RSSFeedURLString
done

And xargs too

for i in ~/Library/Mail/RSS/*/Info.plist
do
    defaults read "${i%.plist}" RSSFeedURLString
done | xargs -n 1 open


[ Reply to This | # ]
10.5: Export Mail.app's RSS feed URLs in Terminal
Authored by: chill_apple on Apr 09, '08 11:07:28AM
I was trying to get to work so that i can port it to NewsFire. I am not very good at BASH and here is what I came up with (Well I borrowed the script that someone did for Safari). NOTE: I left the code that pulls it out of Safari. Any help would be appreciated.

#!/bin/sh
# version 1.2
# 	* added the htmlURL field for Wordpress
#	* escaped XML special strings from the title field
# Written by Sameer D'Costa and released into the public domain
# http://dcostanet.net/wordpress/2005/06/13/export-safari-rss-feeds-via-opml/


cat << HEADER
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
	<head>
		<title>Safari OPML Export</title>
	</head>
	<body>
		<outline text="Mail Feeds">
HEADER
sqlite3 ~/Library/Syndication/Database3 'select *  from Sources;' | \
	sed -e 's/&/\&amp\;/g'  -e 's/</\&lt\;/g' -e 's/>/\&gt\;/g' -e 's/"/\&quot\;/g' -e 's/\x2C/\&#39/g' | \
	awk -F"|" '{printf "<outline type=\"rss\" text=\"\" title=\"%s\" xmlUrl=\"%s\"\ />\
		", $4, $2   }'

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


cat << FOOTER
                </outline>
        </body>
</opml>
FOOTER


Thanks,
Calvin


[ Reply to This | # ]
10.5: Export Mail.app's RSS feed URLs in Terminal
Authored by: chleuasme on Apr 13, '08 06:33:33AM
I just read your post. Here is a bash script which should allow you to import the Mail RSS feeds in NewsFire :
#!/bin/bash

of=/dev/stdout
[ $# -gt 0 ] && of=$1

cat > "$of" << HEADER
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
	<head>
		<title>Mail RSS OPML Export</title>
	</head>
	<body>
		<outline text="Mail Feeds">
HEADER

for mbox in ~/Library/Mail/RSS/*.rssmbox
do
    title=$(echo ${mbox##*/} | sed 's:.rssmbox::')
    url=$(defaults read "${mbox}/Info" RSSFeedURLString)
    echo "<outline type=\"rss\" text=\"\" title=\"$title\" xmlUrl=\"$url\" />"
done >> "$of"

cat >> "$of" << FOOTER
                </outline>
        </body>
</opml>
FOOTER
With no option, it should work the same ways the one you gave code, or you can give an output file name as argument.

[ Reply to This | # ]
10.5: Export Mail.app's RSS feed URLs in Terminal
Authored by: tiktuk on May 14, '10 03:06:33PM
This worked well after I had added (as I also noted in the comment above) another /* because I keep my feeds in folders. And afterwards I had to replace all & characters in urls with & a m p ; (without the spaces..) to make it valid xml.

[ Reply to This | # ]
10.5: Export Mail.app's RSS feed URLs in Terminal
Authored by: tiktuk on May 14, '10 02:57:02PM
As I keep my feeds organized in folders I had to change the above path to ~/Library/Mail/RSS/*/*/Info.plist (note the extra */). Works very well, thank you.

[ Reply to This | # ]
10.5: Export Mail.app's RSS feed URLs in Terminal
Authored by: kson on Mar 28, '08 06:43:56AM

If you want to export your RSS feeds, you can just drag them from Mail.app to Vienna or similar. So I guess it will work to just drag and drop them on a textarea to get the same results as your script. CanĀ“t test though cause I have no feeds in my Mail anymore



[ Reply to This | # ]
10.5: Export Mail.app's RSS feed URLs in Terminal
Authored by: wjv on May 27, '08 05:55:26AM
pubsub --client com.apple.mail list
Or, if you want only the URLs:
pubsub --client com.apple.mail list | cut -f3 | sed -ne '3,$p'


[ Reply to This | # ]
10.5: Export Mail.app's RSS feed URLs in Terminal
Authored by: ATADABUFUG on Jun 27, '08 04:45:59PM

kudos!



[ Reply to This | # ]
10.5: Export Mail.app's RSS feed URLs in Terminal
Authored by: ericlundstedt on Jul 15, '08 11:14:21AM

i also discovered that you can drag and drop between Safari Bookmarks (where your RSS feeds also live) and NetNewsWire. Just open the bookmarks in Safari, select all the feeds, and drag over to NetNewsWire's window. Alot simpler than all this terminal stuff.....(showing my lack of geek-cred).



[ Reply to This | # ]
10.5: Export Mail.app's RSS feed URLs in Terminal
Authored by: sonetseo on Nov 15, '11 08:42:06AM
In Mac OS X Lion 10.7 the location has changed. Here is the command:

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


[ Reply to This | # ]