Export Safari RSS feeds via OPML

I wrote a little shell script to export Safari‘s RSS feeds as an OPML file. This enabled me to import my list of feeds into other News Aggregators.
Update: I have also created an Automator Applicaton, so that the opml file can be created by just doubling clicking.
Usage
Click here to download the Automator Application – Just double click and a Safari.opml file will be created on the desktop containing all your feeds.
Click here to download the shell script – You might need to right click and then save it somwhere.
ExportRss2Opml.sh
To get the OPML bookmarks, go to the directory where you saved the script and run sh ExportRss2Opml.sh > safari.opml in the Terminal.
The file safari.opml will be an opml file containing your Safari feeds. I have tested the script by importing the resulting opml file into bloglines and Firefox’s Sage extension. Your mileage may vary. Let me know if you have any problems or comments.
Notes
- Need to replace xmlUrl with htmlUrl to import into wordpress. http://wordpress.org/support/topic/2432
Versions
- Automator Version 1.2
Shell Script Version 1.2 (Oct 19 2005)- Created an automator version. Just double click and it will create a Safari.opml file for you on the Desktop.
- Released the code into the public domain
- Version 1.1 (Jun 18 2005)
- Escaped more special characters in the title field
- Version 1.0
- Hmm, maybe I would have saved more time if I had done it manually
June 17th, 2005 at 5:57 pm
[...] 7th, 2005, 4:57 pm Thanks to a pointer from Sameer D’Costa, I just used a handy shell script to export all of my Safari RSS subscriptions to an [...]
July 14th, 2005 at 11:32 am
Export Safari Bookmarks into OPML
If you were looking for a way to export your Safari RSS feeds in a standard format (OPML) that is easily imported into other feed aggregators, you should stop looking cause Sameer D’Costa wrote a shell script that will do that for you …
October 20th, 2005 at 10:06 am
Thanks for writing this! I realized that using Safari as an RSS reader turns it into a memory hog. When I switched to NNW, I found your script and it worked fabulously! Thanks!
October 21st, 2005 at 4:37 am
What a great script and the Automator action is incredible! Way to go! Thanks.
October 21st, 2005 at 1:51 pm
[...] Automator is quite a cool component ofTiger. I upgraded my little Export RSS feeds from Safari shell script to an automator action. This is quite handy for the hordes of MacOSX users that abhor Terminal.app. All you need to do is double click the downloaded file and your feeds appear in a file on the Desktop, ready to be sent to any other feed reader. No need to open the terminal and worrying about redirecting shell script output. [...]
November 10th, 2005 at 6:11 pm
[...] A shell script I wrote earlier got mentioned in the December issue of Macworld. It is hard to find the mention, but it is there. I wrote the script to move my feeds from Safari RSS to Bloglines. Last month, I upgraded the shell script to an Automator action, so you do not need to open Terminal.app if you do not want to. The article is a bit incorrect about that point, but I guess it was written a while ago. [...]
December 25th, 2005 at 7:01 pm
anyone know anything about getting this to work for wordpress.com? i downloaded the app, got the opml file on my desktop, did the find and replace, but when i try to import it using my link manager, it gave the following message: XML error: no element found at line 1
any ideas?
December 30th, 2005 at 7:32 pm
I got the same error message when I tried to upload my opml using safari. However, the error message disappeared when I put the opml file on my webserver and then asked wordpress.com to import it from there. Go figure!!
April 11th, 2006 at 6:49 pm
This automator script is great for exporting to an OPML file. Do you know of an automator script for exporting Safari bookmarks and rss feeds to firefox? The basic script is described a the below URL, however I’m not not savvy enough to implement it.
http://www.macosxhints.com/article.php?story=20050706075745579
Any advice would be appreciated.
-Adam
April 26th, 2006 at 3:36 pm
Okay, I implemented it. The description was a little confusing on OSX Hints, so I wrote up a simpler explaination here: http://www.marketanomaly.com/?p=171
May 17th, 2006 at 4:08 pm
You are a life saver! This automater has made Blogroll useful. I never bothered updating it because it was such a pain. Now all I have to do is export my current list of RSS addictions using your nifty app, then empty my Blogroll and upload the OPML. Tada! A current list shows up on my blog for the first time in ages. Thank you again.
May 31st, 2006 at 3:04 pm
[...] One little problem was how to get the feeds I have in Safari over to NetNewsWire, but Google fixed that in 2.3 seconds: Sameer D’Costa had a solution which worked fine. All feeds came over as “Untitled source”, but a quick refresh put their names and favicons back in place. [...]
June 14th, 2006 at 11:47 pm
I can’t get this to work in flock. Is this flock’s problem or is there something wrong with the output?
June 15th, 2006 at 12:02 am
[...] I have a couple of major gripes. It imported my Safari settings only after I explicitly asked it to, and then it failed to do anything useful with my RSS feeds from Safari. Talk about a wet blanket. So I figured out how to create OPML from Safari and tried to import it. Flock failed to import it. Strike two. So then I decided to try the built-in blogging fun, and I’m not impressed with the stupid editor. Composing blog entries in what is basically the same interface as Netscape Composer ten years past is not my idea of cutting edge. I should have the option of starting out in source mode, but more importantly (since editing HTML is even less fun than using a composer-like interface) I should be able to use Markdown or Textile or whatever I want. I’ll still be using flog for writing my posts. [...]
July 8th, 2006 at 8:37 am
I can’t get this to work with Flock either
July 9th, 2006 at 5:24 am
hey,
The Automator app works great. I’ve looked at the OPML file under TextEdit and I can see all the links there.
The reason, dr. Zoiberg, cannot get this to work with Flock is due to some funny problem with the way the app imports OPML files.
The problem isn’t with your script. It works perfectly.
July 12th, 2006 at 7:52 pm
I modified the Automator workflow slightly so that the OPML file can be imported into Flock. Yeah, it’s really Flock’s fault, but still… Anyway, here it is, mostly Sameer’s work anyway so it’s in the public domain as well, for anybody who finds this blog entry via Google like I did –
http://thechef.codekitchen.net/SafariOPML2.dmg
July 22nd, 2006 at 8:40 am
Thanks Code Kitchen!
I’ll try importing right now
July 25th, 2006 at 4:22 pm
[...] I modified Sameer D’Costa’s Automator script for exporting Safari RSS feed bookmarks so that Flock will recognize and import the feeds. This is almost certainly a bug in Flock, but the OPML format seems to have a lot of different ways to do the same thing so just by tweaking the output format I got it to work fine. [...]
August 22nd, 2006 at 3:58 am
[...] read more | digg story [...]
October 17th, 2006 at 11:39 am
Hi,
I seem to be the only one here who’s attempt isn’t working. When I run the script, or the Automater app, all I get is an OPML file with all the correctly formated XML/OPML, but no feeds included.
I have my feeds in a “Feed” folder in the Bookmark Bar (they’re organized in subfolders)… I tried moving the folder into the main Bookmarks Menu as well as the bookmark screen sidebar with the same effect. The feeds *do* show up, obviously in Safaris ‘All Feeds’ screen in the Bookmarks and they work fine as I check them in Safari.
Anyone with the same problem? Am i missing something?
Thanks.
Chris
November 8th, 2006 at 7:44 am
Great app, thank you so much:-)
December 18th, 2006 at 3:03 am
I am having the same problem Chris. Maybe the 10.4.8 update broke something. Running a MacTel, if that makes a difference.
May 2nd, 2007 at 4:58 am
LOL at Version 1.0… thanks for this, works like a charm.
December 11th, 2007 at 10:07 am
I can’t get it to work with Flock …
December 13th, 2007 at 7:52 am
[...] bookmarks to OPML”. From that search I found an Automator action written for this task at Test Blog. Once downloaded (its only 116k) I doubled clicked the Automator Action and it did its thing and [...]
December 14th, 2007 at 5:33 am
[...] the former and imported the OPML file created from Part 1 using the little Automator script from Test Blog. With that done a pop-up is displayed and one is able to decide which feeds you would like to [...]
January 8th, 2008 at 7:05 pm
Thanks for sharing. The application works great.
February 7th, 2008 at 10:51 pm
I ran the automator file you created and just as you said it created a Safari.opml file on my desktop, but when I went to Google Reader and tried to load the file I was told file format not supported. Am I missing a step or something? Thanks for taking the time to make this and field questions.
March 28th, 2008 at 3:42 pm
Works perfectly! All my Safari RSS bookmarks now Googled. Terrific, thank you!
April 4th, 2008 at 8:31 am
Thanks!
April 16th, 2008 at 8:07 pm
btw,
this is incorrect, htmlurl != xmlurl, it is not correct to mindlessly substitute.
htmlurl ideally would be the name of the website and xmlurl is the url to the feed.
April 23rd, 2008 at 7:25 am
Awesome tool, but I don’t think it works with bloglines.
June 1st, 2008 at 4:35 am
[...] feeds as an OPML file. This enabled me to import my list of feeds into other News Aggregators. …http://dcostanet.net/wordpress/2005/06/13/export-safari-rss-feeds-via-opml/Shell script – Wikipedia, the free encyclopediaA shell script is a script written for the shell , or [...]
June 11th, 2008 at 12:07 am
Worked perfectly, thanks!
June 20th, 2009 at 3:06 pm
[...] http://dcostanet.net/wordpress/2005/06/13/export-safari-rss-feeds-via-opml/ [...]
July 19th, 2009 at 10:54 am
After I run the Automater (which seems that it is working) nothing ends up on my Desktop. Is there another location it might be saved?
Running 10.5.7
August 10th, 2009 at 9:22 pm
Automator application is broken for me also. I wonder if it is a Safari 4.x issue, which I’m using as well as 10.5.8. Hope this is fixed soon!
August 10th, 2009 at 10:14 pm
Try searching for Safari.opml in Spotlight.
I’m using 10.5.7 and it works for me. (Safari version 4.0.2). I will update to 10.5.8 and put out a new version if it doesn’t work.
October 8th, 2009 at 11:58 am
I’m on Snow Leopard + Safari 4.0.3, didn’t worked anymore, but this did:
http://www.freesmug.org/review/safari2opml/
January 23rd, 2010 at 6:44 pm
hi,
I couldn t get the script working on my 10.5.8 . I just wanted to export my 71 rss flow out of mail.app so I change some little thing to make the scritp work ($BASH_ARGV problem).
I am sharing it with you , if this can help someone.
cat << HEADER
Safari OPML Export
HEADER
##sqlite3 ~/Library/Syndication/Database3 ‘select * from Sources;’ | \
## sed -e ‘s/&/\&\;/g’ -e ‘s//\>\;/g’ -e ‘s/”/\"\;/g’ -e ‘s/\x2C/\'/g’ | \
## awk -F”|” ‘{printf “\
## “, $4, $2 }’
IFS=$’\n’;for i in $(find ~/Library/Mail/RSS/ -name “Info.plist”);do TITEL=`echo $i | sed -e “s/\.rssmbox\/Info.plist//” | sed -e “s/.*\/\///” | sed -e “s/[\"&<]//g" ` ;egrep "http[s]*://” $i | sed -e “s/.*\(http[^<]*\).*/\1/" | xargs echo -n "”;done
cat << FOOTER
FOOTER
this pass opml validation on all my flow, support https flow, title with reserved caracters . hope it helps.
Vincent.
June 11th, 2010 at 2:23 pm
[...] 1. Moved all my Safari RSS feeds to Google Reader, which has a superior interface anyway, using this tool <http://dcostanet.net/wordpress/2005/06/13/export-safari-rss-feeds-via-opml/>. [...]
August 1st, 2010 at 3:17 am
Sameer,
this doesn’t work with 10.6.4 and Safari 5.0.1: The automator deletes the interim file again after completion, and a Safari.opml is nowhere to be found then.
The updated script by vincent would be nice to have, but it got apparently corrupted here.
Could you please re-post vincent’s post properly quoted, or update yours with his code, then test on 10.6?
August 1st, 2010 at 3:23 am
Uh, update:
vincent’s post mainly need fixing with the “smart quotes”. Turning all “ and ” into ” will get the script to work.
However, vincent’s script doesn’t read Safari’s bookmarks but those from Mail, so that’s not useful for most of us, probably.
Also, running your script in Terminal does still work in 10.6.4, only the Automator action appears to be having trouble as described.
August 1st, 2010 at 4:54 am
Actually,
the script also is useless with Safari 5, it appears: It produces a list of some older RSS bookmarks, not the current ones Safari 5 uses.
August 1st, 2010 at 8:08 am
I just wrote an app that makes this all easier:
http://www.tempel.org/SafariFeedToOPML
Would appreciate if you’d link to it. Your script was helpful in making mine work, i.e. it showed me the format I needed use put into the opml file. Thanks for that!
February 5th, 2011 at 5:37 pm
[...] caso i feed siano in Safari la soluzione migliore si trova all’indirizzo dcostanet.net/wordpress/2005/06/13/export-safari-rss-feeds-via-opml/ sotto due forme: uno script .sh da usare nel Terminale oppure un file per [...]