Giter Site home page Giter Site logo

hltv_python's Introduction

HLTV API

This is a part of my bigger CS:GO Machine Learning project, but might also be a useful module to scrape data from HLTV.

This package offers built-in methods to get popular information from the website, but also, methods to parse a particular page endpoint. Supported pages can be found in corresponding files in src/hltv_api/pages/.

Installation

pip install hltv-api

Example Usage

Some useful methods:

  1. results.get_results - get historical matches along with the overall result
  2. stats.get_matches_with_economy - get historical matches with a breakdown equipment value for each round You can find more examples in examples/.

Simple usage

from hltv_api import results

dataframe = results.get_results(limit=5, start_date="1st Sep 2021", end_date="2nd Sep 2021")

print(dataframe.head())
  • And the output:
match_id date event team_1 team_2 map score_1 score_2 stars
2346480 2021-02-09 ESEA Premier Season 36 North America High Coast Big Chillin bo3 1 0 0
2346339 2021-02-09 BLAST Premier Spring Groups 2021 Vitality Evil Geniuses bo3 1 2 2
2346493 2021-02-09 ESEA Premier Season 36 Europe FATE GamerLegion bo3 1 2 0
2346490 2021-02-09 ESEA Premier Season 36 Europe forZe SAW bo3 1 2 1
2346494 2021-02-09 ESEA Premier Season 36 Europe LDLC Nemiga bo3 1 2 0

Using more complex HLTV filters

from hltv_api import stats
from hltv_api.query import HLTVQuery

query = HLTVQuery(team_names=["Natus Vincere", "Gambit"], player_names=["s1mple"], 
                  maps=["dust2", "inferno", "mirage"], require_all_teams=True)

dataframe = stats.get_matches_with_economy(limit=2, query=query)

print(dataframe.head())
  • And the output:
index match_id map team_1_id team_2_id starting_ct 1_team_1_value 1_team_2_value 1_winner ... 30_team_1_value 30_team_2_value 30_winner
0 2349632 ancient 6651 4608 2 4300 4200 2 ... NaN NaN NaN
6 2349630 mirage 6651 4608 2 3950 4200 1 ... NaN NaN NaN

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.