Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,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 5.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[11,667 views]  

10.5: Export Mail.app's RSS feed URLs in Terminal | 8 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 whomever 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 Wed, Mar 26 2008 at 8:13AM PDT
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 Wed, Mar 26 2008 at 10:49PM PDT
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 Wed, Apr 9 2008 at 11:07AM PDT
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 Sun, Apr 13 2008 at 6:33AM PDT
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: kson on Fri, Mar 28 2008 at 6:43AM PDT
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 Tue, May 27 2008 at 5:55AM PDT
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 Fri, Jun 27 2008 at 4:45PM PDT
kudos!

[ Reply to This | # ]
10.5: Export Mail.app's RSS feed URLs in Terminal
Authored by: ericlundstedt on Tue, Jul 15 2008 at 11:14AM PDT
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 | # ]