Code Monkey home page Code Monkey logo

nba's Introduction

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

nba's People

Contributors

freesuraj avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.