Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 1.41 KB

README.markdown

File metadata and controls

26 lines (20 loc) · 1.41 KB

Really Simple History API

What is it?

I wanted to write a 'this day in history' twitter bot, which posts events which happened on this day. There's a few people on Twitter doing this already, but I am lazy and wanted to automate it.

Luckily, Wikipedia has entries for each day of the year. I wrote a parser to turn this into JSON data, and a very simple Sinatra app to spit out that data for any given day.

Just for kicks, I wrote a pretty simple JS interface as well. You can see it in action on the Today's History page.

How To Use

  • Check out the code
  • Run parse-wikipedia.rb -- This downloads data from Wikipedia for each day of the year and parses it into the JSON output.
  • Get today's history in JSON format at /date.
  • Get another day's history in JSON at /date/month/day where month and day are numbers. For example, /date/2/14 to get the history for February 14th.
  • The data is split into births, deaths, and events. Each element is a hash with one 'text' field. I might add a URL or some other fields later.
  • Take a look at the API javascript or the history ticker to see the code in use.