Not Advocatist, but …

February 16th, 2013  |  Published in mac and iphone, ruby

I have this idea I’d like to work on some time:

MacRumors has this nifty buyer’s guide that tells you when it’s a good idea to be thinking about an upgrade because a given product family is due. If you take a look at the top, there’s some tidy, consistent markup:

There’s a table (class = buyerstable) and number of data cells with lists (class "buyerslist"), each of which contain list items (with classes of red, green and yellow) wrapping the name of each product family.

So … Nokogiri:

#!/usr/bin/env ruby 

require "rubygems"
require "nokogiri"
require "open-uri"

interesting_products = ["iPad", "iPhone", "iPad Mini", "MacBook Air"]

url = ""

doc = Nokogiri::HTML(open(url))'ul.buyerslist').each do |bl|'').each do |product|
    if interesting_products.include?(product.text)
      puts product.text unless product.text.include?("Gazelle")

So, it seems to me there’s a programmatic way to tell if interesting things might be about to happen in Apple’s product lines. Do I care because I’m interested in knowing the best time to upgrade my Apple products?


I care because most Apple writers become insufferable when there aren’t new products for them to fawn over. They delve into bitter, weird little obsessions, spend their time gloating over nits they have successfully picked, and do weird shit like call out Paul Thurott (whom I have met and is a nice guy who gave me a funny Microsoft mug when I was a Linux columnist) and Rob Enderle (who is an absurd thinker whose main contribution to the world of consulting is the productization of trolling). In other words, Mac writers, given no new stuff to talk about, become as bad as the things they hate, just like Nietzsche says people will.

So it occurs to me that if you’ve got a programmatic way to see if product changes are coming, you’ve got a programmatic way to see if the Mac people have anything worth reading. So if you’ve got an RSS reader that can programmatically turn subscriptions on or off, you’ve got a programmatic way to ignore people who become annoying on reasonably predictable cycles. Alternately, maybe something like grapi would do the trick by talking to Google Reader directly (meaning your changes show up on all your devices).

More Precise Annoyance Removal

But what about feeds that are good most of the time, but have annoyances embedded in them? Kind of a nice NetNewsWire feature is the ability to make any script that returns a valid feed into a subscription. I used the example code from the Ruby 1.9.3 RSS library to make a simple script that reads in a feed, skips the stuff that matches a pattern, and then adds the remainder back to a feed:

#!/usr/bin/env ruby
require 'rubygems'
require 'rss'
require 'open-uri'
require 'sanitize'

url = ''
scrub_pattern = /(the\ week\ in|macalope)/i
title = "Scrubbed MacWorld"
author = "Mike's RSS Scrubber"

scrubbed_items = []
open(url) do |rss|
  feed = RSS::Parser.parse(rss)
  feed.items.each do |item|
    title = item.title
    unless item.title.match(scrub_pattern)
      scrubbed_items << item

rss = RSS::Maker.make("atom") do |maker| = author = = "" = title

  scrubbed_items.each do |scrubbed_item|
    maker.items.new_item do |item| =
        item.title = scrubbed_item.title
        item.description = Sanitize.clean(scrubbed_item.description)
        item.pubDate = scrubbed_item.pubDate

puts rss

This clears out a lot of MacWorld’s “second bite at the apple” (heh) roundup posts, and the Macalope, who is dull.

It occurs to me that maybe the overarching project here is to define a set of feeds I have an uneasy relationship with in a simple YAML file, like:

title: Some Mac Dude's Feed
shortname: some_mac_dude
scrub: /somepattern/

Then genericize the script above so a simple Sinatra service can serve up feeds from an endpoint, like Then they’re scrubbed, available to Google Reader, and I can build the “is this blog going to irritate me when Apple’s not rolling out new product” logic into the app.

Say! We can also add tags!

title: Some Mac Dude's Feed
shortname: some_mac_dude
scrub: /somepattern/
    - mac
    - coffee
    - children

And set up an “annoyance” endpoint on the Sinatra app that can add and destroy annoyances from the feeds served. Then a little mobile app to manually toggle annoyances on and off as they occur to me.

Gosh, Mike …

Yeah, I know, o.k.? I know.

Leave a Response

© Michael Hall, licensed under a Creative Commons Attribution-ShareAlike 3.0 United States license.