soccer-cli是使用Python编写的、可以在终端命令行查询足球比分和其它和足球相关信息的应用。它使用football-data.org(http://football-data.org/)做为数据来源,football-data提供过去比分、直播实时比分、球员信息等等,支持欧洲的主要足球联赛(英超、西甲、欧洲足联等等)。
soccer-cli源代码托管在Github(https://github.com/architv/soccer-cli),它在README.md中列出了支持的联赛和球队。
如果你是足球迷和技术宅,这个东西可以值得一试。
1、安装soccer-cli
可以使用pip命令安装:
pip install soccer-cli
使用pip安装的soccer-cli也许不是最新版,可以从源码安装:
pip install git+https://github.com/architv/soccer-cli
2、注册football-data,获得API key
注册地址:http://api.football-data.org/register

它会把key发送到你的邮箱,一个key一天免费只能发起50次请求。
3、使用soccer-cli
在使用之前设置变量:
$ export SOCCER_CLI_API_TOKEN="<YOUR_API_TOKEN>"
也可以把key写入到~/.soccer-cli.ini文件。
查看最新排名:
$ soccer --standings --league=EPL # EPL代表英超

查看live比分:
$ soccer --live
获得一个球队过去10天的分数:
$ soccer --team=LOR --time 10

查询一个球队未来15天的比赛安排:
$ soccer --time 15 --upcoming --team=MUFC

查看帮助:
$ soccer --help
Usage: soccer [OPTIONS]
A CLI for live and past football scores from various football leagues
Options:
--live Shows live scores from various leagues
--use12hour Displays the time using 12 hour format instead of 24 (default).
--standings Standings for a particular league
-league, --league [BL|PPL|FL|SA|EPL|CL|LLIGA|DED]
Choose the league whose fixtures you want to see. See league codes listed in README.
--players Shows players for a particular team
--team


Choose the team whose fixtures you want to see. See team codes listed in README.
--time INTEGER The number of days in the past for which you want to see the scores
--upcoming Displays upcoming games when used with
--time command.
--stdout Print to stdout
--csv Output in CSV format
--json Output in JSON format
-o, --output-file TEXT Save output to a file (only if csv or json option is provided)
--help Show this message and exit.
要获得更多信息,访问:https://github.com/architv/soccer-cli