A Really Simple History API that pulls data from wikipedia to do a 'this day in history' type thing
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
public
views
Gemfile
Gemfile.lock
README.markdown
history.rb
parse-wikipedia.rb
year_parse.rb

README.markdown

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.