Skip to main content

Pull competitive Counterstrike rankings from HLTV.org, ESL and Valve.

Project description

CS rankings - WIP

Pull competitive Counterstrike rankings from HLTV.org, ESL and Valve.

This is done using a Selenium-based webview for HLTV.org and ESL, and using a clone of the git repository for the Valve rankings.

Note that this is still a WORK IN PROGRESS.

Usage

The public methods can be reached by importing from cs_rankings.

from cs_rankings import HLTVRankings, ESLRankings, ValveLiveRankings, ValveRankings, ValveInvitationRankings

client = ValveRankings()  # or one of the others
ranking = client.get_ranking()
client.close()

The variable ranking will be a list of dictionaries for each rank. The dictionaries contain key, value pairs for position, name, points and players.

You can easily convert them to, say, a pandas DataFrame using pd.DataFrame(ranking).

Details on the rankings

There are five Rankings classes available, three that are based on Selenium-based webviews and two based on the git approach. Note that for the git-based rankings you will need to have git installed beforehand.

Selenium-based:

  • HLTVRankings
  • ValveLiveRankings (the Valve rankings as live calculated by HLTV)
  • ESLRankings

Git-based:

  • ValveRankings (the official ones on the Valve own git)
  • ValveInvitationRankings (the official ones used for invitations)

Additional options

For the git-based rankings, the init call supports two extra arguments:

from cs_rankings import ValveRankings

client = ValveRankings(assume_git=True, keep_repository=True)

Both are False by default. If assume_git is set to True, there will be no check on whether Git is installed. If keep_repository is set to True, the Valve git repository will not be removed afterwards, which allows for quick reuse.

For all rankings (git-based or selenium-based), the get_ranking() method supports four extra arguments:

from cs_rankings import HLTVRankings

client = HLTVRankings()
ranking = client.get_ranking(region='asia', date='2024/september/2', min_points=10, max_rank=30)

By default, the most recent global ranking is pulled without filtering by points or maximum rank. Note that supported regions for the HLTV and Valve rankings are differently formatted.

Note: it is not possible to use the region or date inputs for the ESLRanking only. The ESLRanking does support the point or ranking based filter.

Inspiration & credits

This project is based on the hltv-data project by @dchoruzy. That project aims to pull rankings, matches and results from the HLTV website. This project is a fork and rework of hltv-data's main class.

Compared to hltv-data, this project is more narrow since it focuses on rankings only, but it is wider since it can pull more detailed rankings and from multiple sources.

Contributing

Contributions, issues and feature requests are welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cs_rankings-0.1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

cs_rankings-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file cs_rankings-0.1.0.tar.gz.

File metadata

  • Download URL: cs_rankings-0.1.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for cs_rankings-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c50d0219229bc5ee93aecbddca4ac5dc1af7a06ee4bc6934a8aaef15811cddb0
MD5 a4fe702877abc59edf32114c10cc5573
BLAKE2b-256 befeaf02ef8996ef162d70bee86fd8e6bd41d5b83a28977af314b0648addedcb

See more details on using hashes here.

File details

Details for the file cs_rankings-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cs_rankings-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for cs_rankings-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7835499b7a84626fd9ffabeefa1ad5c105b8e378c906bc2398e878132bc86e3
MD5 e3e76e341ec8937e76cc7c12295926bb
BLAKE2b-256 faa1ac29401ab75feb1844c21da7a8f2b3c71945fb902a9ed245edc8b740d314

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page