Sage to Google Reader OPML converter

by

For some reason, when exporting rss feeds from Sage, a Firefox plugin, to an OPML file it does not save the feed (i.e. the xml/rss/atom/whatever) link, but the feeds themselves, i.e. the content of the feeds.

If you have the same problem, here’s a fast-and-dirty solution.

  1. export your Firefox bookmarks in HTML format, in a file called, say, bookmarks.html
  2. using a bash shell, extract the feed lines into a file called feeds.xml doing
     grep FEEDURL bookmarks.html > feeds.xml
  3. create the following script called “scriptfeed.sh”
    #!/bin/bash
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
    echo "<opml version=\"1.0\">"
    echo "<head><title>RSS Subscriptions</title></head>"
    echo "<body>"
    while read line
    do
            temp=`echo $line | awk -F"<" {'print $3;'}`
            feed=`echo $temp | awk -F"\"" {'print $2;'}`
            url=`echo $temp | awk -F"\"" {'print $4;'}`
            text=`echo $temp | awk -F">" {'print $2;'}`
            echo "<outline text=\"$text\""
            echo "  title=\"$text\""
            echo "  type=\"rss\""
            echo "  xmlUrl=\"$feed\""
            echo "  htmlUrl=\"$url\"/>"
    done < feeds.xml
    echo "</body>"
    echo "</opml>"
  4. Give the script the right to execute
    chmod +x scriptfeed.sh
  5. Launch the script on the output file, say, exp.xml
    ./scriptfeed.sh > exp.xml

I know, it’s dirty and tricky, but it works 😛

Advertisements

Tags: , , , ,

3 Responses to “Sage to Google Reader OPML converter”

  1. Frederik Orellana’s blog » Blog Archive » Moving firefox/sage RSS feeds to Google Reader and the iPhone Says:

    […] today I came across this: https://lookherefirst.wordpress.com/2008/09/24/sage-to-google-reader-opml-converter/, which I extended into a little script that reads a Firefox HTML bookmarks file and writes and OPML […]

  2. http://www.youtube.com/ Says:

    I read this piece of writing completely about the comparison of hottest and previous
    technologies, it’s amazing article.

  3. Photo Booth by Expressions Cinema Says:

    Photo Booth by Expressions Cinema

    Sage to Google Reader OPML converter | Look here first!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: