Python Script for Cricket Score!!!

Here’s a script that i wrote to get the latest cricket score without visiting the site. It’s a python script that makes use of rediff scores.

import urllib
class Score(object):
def __init__(self):
self.vars = {} # dictionary variables read from the score file
def refresh(self):
"""Refresh the score"""
url_opener = urllib.URLopener()
url =
self.vars = {}
for stmt in'n'):
stmt = stmt.strip()
if stmt == "": continue
var, val = stmt.split('=')
self.vars[var] = val
return self.vars
def render(self):
"""Return the rendered text"""
return "%(l1)sn%(message)sn%(tagline)sn" % self.vars
class RediffScore(Score):
def getMatchName(self):
return self.vars['tagline']
def getScore(self):
return self.vars['l2']
def getTeams(self):
return self.vars['l1']
def getDate(self):
return self.vars['date']
def getMessage(self):
return self.vars['message']
def getInterval(self):
return self.vars['interval']
if __name__ == '__main__':
print 'Current score'
sc = RediffScore()
print sc.render()

Copy the script in a text editor and save it as in your home folder.
Now run the script by :
animesh@animesh-laptop:~$ python

The output should be somewhat like :
Current score
Australia vs New Zealand
Australia 181-10 (48.4)
S Tait(9)

Note: There is a problem with the script here.. i think when i copy pasted the file the indentation got messed up..
So here’s a link from where you can download it..

If you face any problem please comment. :)