Tuesday, February 19, 2013

Making the News Feeds

One of my favorite things to do at work is to generate the news feeds. I am an avid newshound when it comes to technology, gaming, and a few other subjects, and sharing that passion is really one of my very favorite things. I'm often asked what process I go through to generate the rundowns that I send 1-2 times per day. Here's the secret:


This exercise contains

Here's a quick rundown of the software, scripting languages, and web services I use to make this magic happen:
  • Google Reader is Google's web-based RSS reader. It keeps tabs on site updates so that you don't have to roll around to umpteen million websites hunting for updates.
  • Pocket (formerly Read it Later) is a service that allows users to capture websites for reading later. Articles can be displayed in a "Reader view" which strips out extraneous information from the page, allowing the reader to focus on the content. It is awesome for bookmarking things for later!
  • AppleScript is a scripting language available in Mac OS X. The AppleScript Editor is installed by default in the /Applications/AppleScript folder. Apple's got a great overview on the language here.
  • Google Chrome is Google's web browser. If the usage stats are right, there's a pretty good chance you're reading this in Google Chrome right now.

Starting Conditions

There's a lot of ground out there to cover... a lot of soil to sift to find the nuggets of gold that exist. All of it starts with Google Reader. When I find a news site out there that I like, I add their RSS feed to Google Reader. My feeds in Google Reader are broken down into categories. The category structure helps prepare me for the kind of information I will see, and helps me prioritize what I look at. On an average day, I will get in the neighborhood of 200-400 stories from all of my combined sources.

Processing Stories

Starting with the first category, fingers on the "j" and "k" keys, I start; keying from one entry to the next. For each entry, I skim the headline and the first paragraph, and do one of the following:
  • Skip it - Apparently this story wasn't relevant. Oh well, countless more exist.
  • Open in a New Tab - Hmmm, there might be something interesting here that others might be interested in as well. Let's keep this one open and continue on.
  • Add it to Pocket - This story is very interesting to me, but probably won't interest my coworkers or anyone else. Let's drop that in Pocket and read it later.
Lather, rinse, and repeat until all stories have been read.

Forge an E-mail

Now I've got a Google Chrome window with a few open tabs of stories that I'm ready to send to my unsuspecting vict-- I mean, coworkers. I reorder those tabs (dragging and dropping is so much fun at 7:30am before that first cup of coffee) to put the most relevant stories up front (that story about the Battle of Hoth being a monumental military blunder for the Empire... yeah, it can probably go to the bottom). It used to be that I'd go tab by tab, copying and pasting URLs and scrawling down page titles. Soon after that, I decided that copying and pasting was for squares, and I could cover more of that work with a simple automation script. Since I use a Mac at work, Applescript seemed like the tool of choice.
This little wonder sits in the script menu on my menu bar, under the Google Chrome folder. When I click on the script, it will do the following:
  1. Grab the front-most Chrome Window.
  2. Go through each tab and append a bullet, the page title, a carriage return, the page URL, and another carriage return.
  3. Create a new Mail message with a subject, "[News]", already addressed to the teams I e-mail to.
  4. At my list 'o knowledge into the e-mail body.
What I'm left with is a new mail message, already addressed, with all of my content. All I need to do is add additional recipients, round out the subject (give 'em teasers to what's in there), and click send. Check out the script here if you're curious.

News to Mail Message.scpt

-- Create a list of all tabs in the frontmost Google Chrome window with their title and URL (up to the ?… we don't need parameters in the links).
tell application "Google Chrome"
    set myOutput to "News for " & (current date) & return
    repeat with i from 1 to (count of tabs in front window)
        set myTitle to (title of tab i in front window)
        set myURL to (URL of tab i in front window)
        if (offset of "?" in myURL) > 0 then
            set myURL to text 1 thru ((offset of "?" in myURL) - 1) of myURL
        end if
        set myOutput to myOutput & return & "• " & myTitle & return & "  " & myURL & return
    end repeat
end tell

-- Open up a new mail message, set the subject to "[News]", add recipients, and set the body content to the list created above.
tell application "Mail"
    activate
    set myMail to make new outgoing message with properties {visible:true, subject:"[News] ", content:myOutput}
    tell myMail
        make new to recipient at end of to recipients with properties {name:"Joe User", address:"joeuser@somesite.com"}
        make new to recipient at end of to recipients with properties {name:"Jane Other-User", address:"janeouser@somesite.com"}
    end tell
    set message signature of myMail to signature "Super Cool Signature of Awesomeness +5"
end tell

-- You should end up with a mail message containing the list of links. Now all you need to do is fill in the subject line, add additional recipients, and click send.

Is that it?

Now that things are sent, I have time to read through the stories more in-depth, check comments, and even post a few to Google+ while I'm at it. Later on, when I leave work, there's an opportunity to check out those items I sent to Pocket too.

If you want to if it's helpful, you'd have to ask my coworkers, but most of them tell me that the stories I send help inform them of new ideas and trends, and that ultimately helps us make better products. For that reason alone, I feel like my work is done here. If I weren't doing this at work, I'd most certainly be reading it all myself anyway.