powellc / NBA

Command line NBA written in Python

Home Page:http://www.kakhara.com/NBA/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NBA

This is my personal hobby project to learn web scraping in python. It's a command line tool to access NBA scores, box-score and standings. Data is scraped from yahoo.

It uses lxml for web scraping. I found another more interesting package called scrapy for web scraping. Underneath scrapy also depends on lxml. So I decided to try out using lxml first.

screenshot

How to run?

It uses python3, and relies on few libraries. Recommended way to try it is by installing python3 via virtualenv

Install pip

pip is available if you install python using brew in mac. If it doesn't work, you can try followings:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

Using virtualenv

  • Installation and Activation
pip install virtualenv
virtualenv <DIR>
source <DIR>/bin/activate
  • To deactivate:
deactivate

Dependencies

To install all dependencies at one go,

	pip install -r requirements.txt

Running NBA

  • To get Today's scores:
python nba.py
  • To get Scores before X day(s):
python nba.py -y X
  • To get box score of a match
python nba.py -b MATCHID
  • To get standings
python nba.py -s
  • To get Profile of a Player
python nba.py -p 'Kobe Bryant'
  • To get help
python nba.py -h

Usage: nba.py [options]

Options:
  -h, --help            show this help message and exit
  -s, --standings       Show NBA standings
  -b BOXID, --boxscore=BOXID
                        Show box score of a match ID
  -y MINUSDAY, --yesterday=MINUSDAY
                        Shows game scores of y days before today
  -p PLAYER_NAME, --player=PLAYER_NAME
                        Get Player profile

About

If you found this little tool useful, I'd love to hear about it. You can also follow me on Twitter at @iosCook

About

Command line NBA written in Python

http://www.kakhara.com/NBA/


Languages

Language:Python 89.9%Language:Ruby 10.1%