Subscribing To hAtom Feeds With NetNewsWire

As I see it, the big “wins” for microformats are the ability to take a convention for tag and class usage and layer it over markup that you’re already using in a document to add additional functionality or more specific meaning to the content without adding bloat or working with embedding content that isn’t (X)HTML.

I’ve mentioned hAtom a few times, and I’ve mentioned implementing it on ChunkySoup.net—but in doing that I was left with the feeling that it was quite geeky, but needed some way to leverage that information ow that it was there. Tails is a great plugin for Firefox for picking up data contained in hCards, hCalendar events and a few other data items, but consuming hAtom documents still isn’t easy for the average person. So those wins by following the conventions laid out weren’t yet realized.

Thinking it was time for a solution I turned to NetNewsWire (the /only/ feed reader for OS X), its support since version 2.0 for subscribing to scripts and started hacking on a few shell scripts and AppleScript files looking for a way to make subscribing to pages with hAtom feeds easy. What I’ve come up with is an AppleScript document that’s just been posted for distribution:

Download Subscribe To hAtom v0.2

Installing

Installing the script is as simple as downloading the zip file and putting the documents in the right spot.

  1. Have NetNewsWire 2.x already installed.
  2. Download Subscribe To hAtom in a zip file
  3. Open the zip file to extract the following 3 files: Subscribe To hAtom.scpt, hAtom2Atom.xsl & uri.xsl
  4. Move or copy all 3 files to the NNW script folder at ~/Library/Application Support/NetNewsWire/Scripts/

The script is now “installed”.

Subscribing

Subscribing to a web page with this script is similar to subscribing to any other feed, though you’ll have to enter some additional info in the Show Info window.

  1. Instead of the typical menu or toolbar item to subscribe to a feed use the New Special Subscription menu to make a new Script subscription. File Menu:New Special Subscription...:Script...
  2. You’ll presented with a Finder window that will as you to choose what script, pick “Subscribe To hAtom@. Finder Window: Subscribe To hAtom
  3. Then you’ll be shown a standard Info panel, you may have to expand some of the sections to enter the data but the 3 important pieces of information you’ll need to check before pressing Run Script or closing the dialog are: Show Info Dialog
    1. General – Name: Name the feed
    2. Script Settings – Path: This should already be filled out with the path to to the script
    3. Script Settings – Ards: Puth the URL of the web page you’re subscribing to here
  4. You’re now subscribed to the page as you would any other feed and you should see some fresh items in your subscription window. NetNewsWire window with new subscription

Updates

For updates to the Subscribe To hAtom AppleScript watch this blog. The XSLT document the script uses to parse the documents is developed independently and is called hAtom2Atom. Just download the new version and replace the old file with it.

Some examples of pages on ChunkySoup.net that can now be subscribed to with this script that otherwise don’t have more conventional RSS or Atom feeds:

And of course, though it is a bit redundant, you can subscribe to the front page and get something similar that you get by subscribing to the existing feeds.

Some other sites implementing hAtom can be found in the microformats.org wiki.

The script in its current form is fairly simplistic and just passes the selected web page through xsltproc as is. It does the job, at least as a proof of concept. Look for later version to be a bit more robust, using Tidy if available on the system so it can handle more html pages and doing a better job of communicating errors to NetNewsWire (if I can pick up enough AppleScript to do what I’d like).

Give it a try and let me know if there’s anything else you’d like to see it do.

8 thoughts on “Subscribing To hAtom Feeds With NetNewsWire

  1. Doesn’t work for me in NNW 2.1b17. I get a window when I try to subscribe, but it isn’t the window you show here. It has only “General” and “Debug” sections, and I can’t edit the “General”. Also, all three files show up under the scripts menu. I thought the scripts folder was for AppleScripts that use the NNW AppleScript hooks, not subscribe-able scripts.

  2. Scott,

    What version of OS X are you running? I saw there was a known problem on 10.3.9 with the show info panel in general that should be fixed soon, but I have testing myself and the feed works in 2.0 on 10.3.9 and have had others report it working on 10.4.x with “recent” betas (though I can’t report what version offhand)

    Tanktek,
    Will do

  3. Also Scott,

    Do you not think the scripts folder is the appropriate place for the files?

    I do hate to have some of the values hard coded, but I was having some issues with the script failing seemingly randomly when trying to use relative paths. Its something that I’d like to look at in a future version, but even if I work on my AppleScript-fu to the point of alowing the files to be placed anywhere the user prefers, but even then I would like to ofer the user guidance on the place to put it.

  4. There is a bug in the current beta with the Info window when you add a script subscription. (It will get fixed before shipping.)

    The work-around, for now, is just to select some other subscription, then select the script subscription again. This time the Info window should show the script settings, and you can set up the script.

    (Which I just did—it works! Cool script.)

  5. Hey Brent, thanks for the details on the Beta—and the kind words.

    Hopefully at some point in the future a script like this won’t be needed as an addon because its supported inside of NNW. hint, hint

  6. I just came across this script. Excellent stuff! I wanted to remove the hard-coded path, so came up with this change:

    tell application "Finder" to set folder to (container of (path to me)) as string
    set transform to POSIX path of (folder & "hAtom2Atom.xsl")

    It should work with any OS X feed reader that can read the output of scripts.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>