The Longreads blog has a unique feature: it tells you how long it will take you to read each article (I figured out that it takes the article’s word count, and assumes an average reading time of 250 words/minute). This got my mind jogging a bit, and after playing around with some geolocation APIs, I thought it’d be cool to do an app that would give you enough stuff from Longreads to read on your commute.
At the hack day, I ran this past John Keefe, and we got to talking a bit. He came up with the idea of, instead of limiting it to Longreads, extending the app to any Twitter account— scrape the links out of a Twitter feed and aggregate the word counts. Then present just enough articles to read on your commute. Since the code behind Readability (a bookmarklet to isolate articles from site detritus) is open source, and the HopStop API gives you time estimates for travel time between any two addresses in New York we were in business.
Working with John and the indefatigable Erik Hinton (my former partner in crime at TPM), we built Trippy in about 9 hours at the TimesOpen hack day this Saturday. It’s written in Ruby and Sinatra, and does a lot of cool stuff behind the scenes to get you your articles. Here’s how it works:
When you put in your origin and destination addresses, it sends them off (via delayed_job) to the Google Maps geocoding API to convert them into latitude and longitudes. (Though, if you click the ‘geo’ button, and have GPS enabled, the app can get your origin automatically). From there, it passes the lat and long to the HopStop API to get the Subway travel time between the two distances. It then takes the Twitter account or Twitter list (to use a list enter
account/list_name in the Twitter account field) and uses the twitter-text gem to extract the links. From there, it uses the crazy Typhoeus gem to simultaneously evaluate all the short links and suck down all the pages in parallel. It runs them through Readability, grabs the word counts, rejects pages with under 250 words (as these probably aren’t actually articles), and then presents them in a tidy Instapaper-esque page for you to read on the train. To sweeten the pot, the app is also “responsive” or at least “switchy” for different screen sizes. I think it looks pretty good on the iPhone and Android.
By the way, Trippy was one of the hack day winners, garnering a $200 Amazon gift card (and a role in saving journalism).
So, here it is: