NetNewsWire Subscription Favelet #
As I was pondering the implications of the Safari RSS announcement (my thoughts pretty much mirror Brent's) I realized that a web browser/feed aggregator combo does have one thing going for it. Subscription to a site right now requires at best a drag-and-drop of the site's URL into NetNewsWire, and at worst looking through the page (or its source) for the (possibly orange) RSS/XML/Atom icon. The blue logo that Safari RSS adds to the location bar makes it much more obvious when a site has a feed, and this is some functionality that NNW doesn't have. It could perhaps be added to current versions of Safari with an InputManager extention á la PithHelmet or Saft. Clicking on it would subscribe to the site's feed using NetNewsWire, or whatever aggregator was registered as a handler for the feed:// protocol. However, this requires a level of Cocoa-based hacking that I'm not familiar with and aren't prepared to learn just yet.
As a hack-ish alternative, a favelet could be used to at least allow one-click subscribing to a site. Such favelets/bookmarklets already exist, but they rely on RSS Auto-Discovery. The problem with that is that it is a relatively brittle approach, i.e. it fails completely if a site doesn't use auto-discovery, even if it may have a feed. Mark Pilgrim's Feed Finder tries much harder to find the RSS or Atom feeds that relate to a page, while doing elegant things like respecting a site's robots.txt file. Re-implementing its functionality in JavaScript didn't seem like an appealing option, so instead I used a hybrid approach. This simple CGI script lives on my server, and calls Mark's tool (I am a total Python newbie, thus there may be better ways of achieving this):
import os, feedfinder if os.environ.has_key('QUERY_STRING'): uri = os.environ['QUERY_STRING'] try: feeds = feedfinder.getFeeds(uri); if (len(feeds) > 0): print "Location: feed://%s\n\n" % (feeds[0]) else: print 'Content-type: text/html\n\nNo feed(s) found at the given URL.\n' except IOError: print 'Content-type: text/html\n\nCould not access given URL.\n' else: print 'Content-type: text/html\n\nNo URL was given.\n'
The Subscriber favelet then simply invokes it with the current page's URL. If a feed is found, the redirect within the CGI script triggers the feed:// protocol handler thus invoking the aggregator. Such a favelet has the advantage of being easily updatable; if the auto-discovery standard were to change or if Mark figures out even more clever ways of determining if a site has a feed, then all its uses would immediately benefit.
Post a Comment