为所有NHL团队刮去徽标
nhl-logo-scraper的Python项目详细描述
为所有nhl团队、联盟和网络刮取徽标
Usage
首先克隆项目。
$ git clone https://github.com/blindman/nhl-logo-scraper.git
克隆项目后,运行以下命令以使实用程序在终端中工作。
$ pip install . $ nhlscraper --help
刮擦
$ nhlscraper scrape [--output=DIR] [--format EXTENSIONS] [--archive]
--output=DIR | The directory to dump all of the files [default: ./output] |
--format EXTENSIONS | |
Image output formats (svg and/or png) [default: svg] | |
--archive | Archive any previous logos that were downloaded [default: True] |
--debug | Allow debugging logs through |
清洁
$ nhlscraper clean [--dir=DIR] [--category CATEGORIES] [--full]
--dir=DIR | The directory that the files live in [default: ./output] |
--category CATEGORIES | |
Categories to remove all files (league, network, team) | |
--full | Clean all files created by this tool (includes archives) |
--debug | Allow debugging logs through |
其他
$ nhlscraper -h | --help
$ nhlscraper --version
Contributing
假设已经克隆了项目并创建了virtualenv,请运行以下命令来处理代码。
$ virtualenv –python python3 venv $ source venv/bin/activate $ pip install -e .[test]
要测试代码,请运行以下命令。
$ python setup.py test
Notes
这是我以前的imageDownloader存储库的一个分支,它做了相同的事情,但作为bash脚本,并且用于nhl.com的前一个版本
您可能已经注意到,nhl.com被请求并解析为查找::code`nhl logos.css',而不是直接检索css文件。这是因为(我相信)该文件的路径可能会更改。当前路径是::code::../builds/../f0683b50089da6c16c1df297a9a74ce08e79b94b_1507226889/../nhl logos.css,由于中间的大块看起来像一个唯一的标识符,因此我假设它会更改。我希望实现某种缓存,这样它就不会每次都发出请求。
License
麻省理工学院[jon heller](https://github.com/blindman)