<commit_before>#RiotScraper

RiotScraper is a python script to download and store League of Legends matches with the Riot API.

##Simple
To build your matches dataset it is as simple as 

```python3 match_downloader.py config.json```

with config.json
```json
{
  "cassiopeia": {
    "api_key": "your-api-key",
    "region": "NA"
  },
  "destination_directory": "path-to-directory",
  "seed_players": ["nightblue3", "feed l0rd"]
}
```

RiotScraper will look for recent matches of the seed players and start downloading and storing them. Then it will repeat the process for every player who played in those matches.

##Efficient
RiotScraper will

 - store the matches as compressed files
 - sleep while waiting for the rate limits, not consuming CPU time
 - efficiently use memory to avoid repetitions of matches and players (by clearing the matches and players history between time slices)

##Configurable
While the example configuration is extremely short and easy to use, the available options cover all the needs. 

[This comprehensive configuration](https://github.com/MakersF/RiotScraper/blob/master/riot_scraper/configuration%5Bno%20annotations%5D.json) shows all the options available.
[This is the same configuration](https://github.com/MakersF/RiotScraper/blob/master/riot_scraper/configuration.json) with several annotations to specify what element is optional and a brief description of them.

If the `destination_directory` element starts with `__file__`, `__file__` will be replaced with the directory containing the configuration json. This way you can specify a directory relative to the configuration file.

##Customizable
If your needs are different from the usual ones, you can import RiotScraper as a library.
The [`download_matches` function](https://github.com/MakersF/RiotScraper/blob/master/riot_scraper/match_downloader.py#L25) takes a `store_callback` function in addition to all the parameters the configuration file exposes. The function is called every time a match is downloaded. You can pass your own function and do whatever you want with the stored matches: send it over ssh to another server, translate it to Klingon, restructure it to XML, remove the parts you know you wont use, or just ignore it. 

##Setup
No need to install it. Just download the repository, and call
`python3 match_downloader.py configuration_file.json`

##Dependencies
RiotScraper is build over [Cassiopeia](https://github.com/robrua/cassiopeia).
You can install Cassiopeia following the [library setup documentation](https://github.com/robrua/cassiopeia#setup).
Here is a snippet (or better, all it takes)
``` pip3 install cassiopeia```

If you prefer to not install Cassiopeia, you have an alternative!
[Download the Cassiopeia repository](https://github.com/robrua/cassiopeia/archive/master.zip), extract it, set the path into which you extracted them into [the scripts](https://github.com/MakersF/RiotScraper/tree/master/riot_scraper/run_scripts), and call `match_downloader` from your CLI as if you were calling `match_downloader.py`

##Tests
The tests require an API key. Create a file called ```api-key``` in the project root directory (where the .gitignore file is stored) with only your api key inside. The file is already on .gitignore, so there is no risk for you to commit and push it on the web.

##Disclaimer
RiotScraper isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing League of Legends. League of Legends and Riot Games are trademarks or registered trademarks of Riot Games, Inc. League of Legends © Riot Games, Inc.<commit_msg>Changed the name in the readme<commit_after>#LoLScraper

LoLScraper is a python script to download and store League of Legends matches with the Riot API.

##Simple
To build your matches dataset it is as simple as 

```python3 match_downloader.py config.json```

with config.json
```json
{
  "cassiopeia": {
    "api_key": "your-api-key",
    "region": "NA"
  },
  "destination_directory": "path-to-directory",
  "seed_players": ["nightblue3", "feed l0rd"]
}
```

LoLScraper will look for recent matches of the seed players and start downloading and storing them. Then it will repeat the process for every player who played in those matches.

##Efficient
LoLScraper will

 - store the matches as compressed files
 - sleep while waiting for the rate limits, not consuming CPU time
 - efficiently use memory to avoid repetitions of matches and players (by clearing the matches and players history between time slices)

##Configurable
While the example configuration is extremely short and easy to use, the available options cover all the needs. 

[This comprehensive configuration](https://github.com/MakersF/LoLScraper/blob/master/riot_scraper/configuration%5Bno%20annotations%5D.json) shows all the options available.
[This is the same configuration](https://github.com/MakersF/LoLScraper/blob/master/riot_scraper/configuration.json) with several annotations to specify what element is optional and a brief description of them.

If the `destination_directory` element starts with `__file__`, `__file__` will be replaced with the directory containing the configuration json. This way you can specify a directory relative to the configuration file.

##Customizable
If your needs are different from the usual ones, you can import LoLScraper as a library.
The [`download_matches` function](https://github.com/MakersF/LoLScraper/blob/master/riot_scraper/match_downloader.py#L25) takes a `store_callback` function in addition to all the parameters the configuration file exposes. The function is called every time a match is downloaded. You can pass your own function and do whatever you want with the stored matches: send it over ssh to another server, translate it to Klingon, restructure it to XML, remove the parts you know you wont use, or just ignore it. 

##Setup
No need to install it. Just download the repository, and call
`python3 match_downloader.py configuration_file.json`

##Dependencies
LoLScraper is build over [Cassiopeia](https://github.com/robrua/cassiopeia).
You can install Cassiopeia following the [library setup documentation](https://github.com/robrua/cassiopeia#setup).
Here is a snippet (or better, all it takes)
``` pip3 install cassiopeia```

If you prefer to not install Cassiopeia, you have an alternative!
[Download the Cassiopeia repository](https://github.com/robrua/cassiopeia/archive/master.zip), extract it, set the path into which you extracted them into [the scripts](https://github.com/MakersF/LoLScraper/tree/master/riot_scraper/run_scripts), and call `match_downloader` from your CLI as if you were calling `match_downloader.py`

##Tests
The tests require an API key. Create a file called ```api-key``` in the project root directory (where the .gitignore file is stored) with only your api key inside. The file is already on .gitignore, so there is no risk for you to commit and push it on the web.

##Disclaimer
LoLScraper isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing League of Legends. League of Legends and Riot Games are trademarks or registered trademarks of Riot Games, Inc. League of Legends © Riot Games, Inc.
{'fraction_non_alphanumeric': 0.07052689352360043, 'fraction_numerical': 0.0030186608122941823, 'mean_word_length': 5.033940397350993, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 22, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '549536', 'n_tokens_mistral': 2028, 'n_tokens_neox': 1943, 'n_words': 926}