atahanuz / lol-stats

Your all time LOL ranked statistics across all of your accounts !
2 stars 0 forks source link
league-of-legends python selenium webscraping

lol-stats

Python library to find your League of Legends ranked statistics across all of your accounts. This script finds your all time ranked statistics (Season 1 to Season 13) across all of your accounts and merges them. You will see your:

for each champion and a grand total.

Installation

pip install lol-stats

Google Chrome must be installed on your system. The program automatically installs ChromeDriver binaries required for Selenium web scrapping.

Usage

Lauch the program:

import lol_stats

lol_stats.launch()

In console you'll see that the program is launched. Go to http://localhost:8126 from a browser to interact with the program.

To run the program on a different port, you pass an optional argument to launch() function:

lol_stats.launch(port=1234)

Note: The program is multithreaded to process multiple accounts as quickly as possible. This may cause high CPU and RAM usage, which is normal.

Example Output

How it works

The program uses Selenium for web scrapping. It opens Google Chrome in background, visits op.gg page for each account and scrapes the data. Since op.gg doesn't provide an API for fast data retrieval, the only option is physically visiting it from browser. This is why the program is resource-intensive and can take some time.

Notes

Data for accounts:
https://www.op.gg/summoners/kr/hide%20on%20bush/champions
started processing
installing chromedriver
installed chromedriver
concurrent execution
started https://www.op.gg/summoners/kr/hide%20on%20bush/champions
Page is fully loaded.
time=  0.1226658821105957 seconds
1
hide_on_bush
Recorded Season 2023 S2 for https://www.op.gg/summoners/kr/hide%20on%20bush/champions
time=  0.705498218536377 seconds
2
hide_on_bush
Recorded Season 2023 S1 for https://www.op.gg/summoners/kr/hide%20on%20bush/champions
time=  0.6393542289733887 seconds
...
--- 18.71 seconds ---
ENDED !

Contact

For problems or suggestions raise an Issue in this repo and I'll happily respond. You can mail me at atahanuz23@gmail.com but it'd be better if you raise an Issue so everyone can see and contribute to the discussion. It also sends a notification to my phone so I can respond faster.