Skip to content

Commit

Permalink
Project basic structure commited
Browse files Browse the repository at this point in the history
  • Loading branch information
semk committed Nov 23, 2010
1 parent b97f456 commit e2f594a
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ESPNcricinfo is the largest[citation needed] cricket-related website. It includes news and articles, live scorecards, and a comprehensive and queriable database of historical matches and players from the 18th century to the present.

This Python libary provides an api for accessing information from CricInfo like live scores, news updates and player profiles.
30 changes: 30 additions & 0 deletions cricinfo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#! /usr/bin/env python
#
# Python library for accessing information from http://cricinfo.com
# (Live scores and updates)
#
# @author: Sreejith K
# Created On: 24 Nov 2010

import urllib

live_scores_xml = 'http://espncricinfo.com/rss/livescores.xml'

class CricInfo:

def __init__(self, live_scores_xml = live_scores_xml):
self.live_scores_xml = live_scores_xml
self.xml_data = None
self.live_scores = {}

def get_xml_data(self):
self.xml_data = urllib.urlopen(self.live_scores_xml)

def update_live_scores(self):
self.get_xml_data()
self.live_scores = self.parse_xml()

def parse_xml(self):
# parse the xml and populate the dictionary with needed information.
pass

31 changes: 31 additions & 0 deletions cricinfo/live_scores.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>Cricinfo Live Scores</title>
<ttl>2</ttl>
<link>http://www.cricinfo.com</link>
<description>Latest scores from Cricinfo</description>
<copyright>(c)Cricinfo</copyright>
<language>en-gb</language>
<pubDate>Tue, 23 Nov 2010 18:58:03 +0000</pubDate>

<item>
<title>Pakistan 434/10 v South Africa 584/9 &amp; 173/4 *</title>
<link>http://www.cricinfo.com/ci/engine/match/461572.html?CMP=OTC-RSS</link>
<description>Pakistan 434/10 v South Africa 584/9 &amp; 173/4 *</description>
<guid>http://www.cricinfo.com/ci/engine/match/461572.html</guid> </item>
<item>
<title>Sri Lanka 84/3 * v West Indies</title>

<link>http://www.cricinfo.com/ci/engine/match/464988.html?CMP=OTC-RSS</link>
<description>Sri Lanka 84/3 * v West Indies</description>
<guid>http://www.cricinfo.com/ci/engine/match/464988.html</guid> </item>
<item>
<title>Victoria v Queensland</title>
<link>http://www.cricinfo.com/ci/engine/match/474064.html?CMP=OTC-RSS</link>
<description>Victoria v Queensland</description>
<guid>http://www.cricinfo.com/ci/engine/match/474064.html</guid> </item>

</channel>
</rss>

9 changes: 9 additions & 0 deletions cricinfo/page_parser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /usr/bin/env python
#
# Python library for accessing information from http://cricinfo.com
# (Live scores and updates)
#
# @author: Sreejith K
# Created On: 24 Nov 2010


0 comments on commit e2f594a

Please sign in to comment.