I just wrote a quick code:

#!/usr/bin/python
# Using Twitter to find out how special today is
#
# This code is in Public Domain.
#
# Author:
#  2009 Yu-Jie Lin


from sys import exit
from urllib import urlopen
import simplejson as json


TREND_API = 'http://search.twitter.com/trends/current.json'


f = urlopen(TREND_API)
if f.info()['status'] == '200 OK':
  _, trends = json.loads(f.read())['trends'].popitem()
  for t in trends:
    if 'day' in t['name'] or 'Day' in t['name']:
      print t['name'].replace('Happy', '').replace('happy', '').replace('#', '').strip()
else:
  print 'Unable to retrieve, status code: %s' % f.info()['status']
  exit(1)

It shouldn’t be hard to guess what this script does.

If you ever read the trending topics at side of your Twitter homepage, you must have learnt some things you wouldn’t have heard before. Sometimes, they bring you interesting things. Well, not always, but still fun to read them.

One thing I have noticed is everyday seems to be a very special day. You can read #fooday or Happy Bar Day, or something like that in trending topics. I guess that also prompts you or reminds us: Don’t give upon this special day. (I don’t know why I said that, it’s just popping up out of my head)

A quick example for this moment of writing this posting, this code prints out or Twitter tells about this day is:

$ ./TwitterTellsTheDay.py
Mothers Day
bouvierb-day

So, how are you today?