Aug 12, 2016

Get Football (Soccer) Scores, Fixtures, And Standings From The Command Line With Soccer CLI

If you prefer working at the command line to using a graphical interface, and you're a football (soccer) fan, Soccer CLI is for you.

soccer cli

The app uses the API to provide past and live football scores, standings, upcoming fixtures, and player information. All major European football leagues are supported, including Premier League, La Liga, UEFA Champions League, and more.

Smaller leagues, as well as UEFA Europa League, are not supported, at least for now.

A list of supported leagues and teams, as well as the codes, can be found HERE.

Here are a few Soccer CLI examples:

- get the latest league standings for La Liga:
$ soccer --standings --league=LLIGA

1 FC Barcelona 38 83 91
2 Real Madrid CF 38 76 90
3 Club Atlético de Madrid 38 45 88
4 Villarreal CF 38 9 64
5 Athletic Club 38 13 62
6 RC Celta de Vigo 38 -8 60
7 Sevilla FC 38 1 52
8 Málaga CF 38 3 48
9 Real Sociedad de Fútbol 38 -3 48
10 Real Betis 38 -18 45
11 Valencia CF 38 -2 44
12 UD Las Palmas 38 -8 44
13 SD Eibar 38 -12 43
14 RCD Espanyol 38 -34 43
15 RC Deportivo La Coruna 38 -16 42
16 Sporting Gijón 38 -22 39
17 Granada CF 38 -23 39
18 Rayo Vallecano de Madrid 38 -21 38
19 Getafe CF 38 -30 36
20 Levante UD 38 -33 32

- get live scores (there are no actual live matches at the time I'm writing this article, but in this case, today's fixtures are displayed):
$ soccer --live
====================== Dutch Eredivisie ======================

Heerenveen - vs - FC Utrecht 21:00

======================= French Ligue 1 =======================

Bastia - vs - Paris Saint-Germain 21:00

AS Monaco - vs - Guingamp 21:30

====================== Portuguese Liga =======================

Rio Ave - vs - FC Porto 22:30

- get all Karlsruher SC (2. Bundesliga; major European leagues did not start yet) scores for the past 10 days:
$ soccer --team=KAR --time 10

2016-08-07 Arminia Bielefeld 0 vs 0 Karlsruher SC

- get upcoming fixtures for Manchester United, for a period of 15 days:
$ soccer --time 15 --upcoming --team=MUFC

AFC Bournemouth - vs - Manchester United FC Sun 14, 15:30

Manchester United FC - vs - Southampton FC Fri 19, 22:00

Using the latest Soccer CLI from Git, you can get a list of football leagues, teams, and their codes, by using the following command:
soccer --list

To see all the available options, use:
soccer --help

For more examples and usage, see the application GitHub page.

Install Soccer CLI and set up the API key

The last Soccer CLI release is old and has missing features (missing football leagues, etc.). The instructions below will install the latest Soccer CLI from Git.

1. Install Python pip

In Ubuntu, Linux Mint, etc., install it using the following command:
sudo apt install python-pip

2. Install the latest Soccer CLI from Git via Python pip (for the current user only):
pip install

3. Add ~/.local/bin to your PATH

The Soccer CLI executable is installed by python-pip under ~/.local/bin/, and you'll need to add it to your PATH. The following command adds it to ~/.bashrc (replace it with ~/.zshrc if you use Zsh):
echo "PATH=\"\$HOME/.local/bin:\$PATH\"" >> ~/.bashrc

Next, source ~/.bashrc so the new configuration is used (opening a new shell should do it as well):
. ~/.bashrc

Soccer CLI should now be installed.

4. Register on to get an API key, and configure Soccer CLI to use it

Visit THIS page and register. The API key should be emailed to you.

To set Soccer CLI to use your API key, simply run "soccer" in the terminal and paste the API key when prompted:

soccer cli api

Note that the link displayed by Soccer CLI, the first time you run it, does not work.

You can also set the API key by using:
soccer --apikey YOUR_API_KEY

That's it!

app seen @

via Web Upd8 - Ubuntu / Linux blog