New Twitter bot: @TwoHeadlines

by Darius Kazemi on September 11, 2013

in bots,project,projects,twitter

A couple weeks ago I quietly launched a new Twitter bot, @TwoHeadlines. It’s my attempt to automate jokes where people mix up two popular headlines from a given day.

The algorithm is simple. Because there are no good news APIs out there, I resort to basic screen-scraping. Here’s what it does:

  • Goes to http://news.google.com
  • Grabs a random category (Business, World, Sports, etc) from the list in the left-hand sidebar, and a random topic from that category
  • Grabs a random headline from that topic, which also has the topic word itself in the headline
  • Grabs a different category from the list in the left-hand sidebar, and a random topic from that category, and replaces the original word with that

So if “Apple” and “United States” are both in the topics lists, it might grab “Apple releases new phone” and generate “United States releases new phone.” Here’s my favorite example so far:

{ 1 comment }

Aaron Styles September 11, 2013 at 8:44 pm

You sir are a crazy genius!

Comments on this entry are closed.

Previous post:

Next post: