GithubHelp home page GithubHelp logo

hltv's Introduction

Dependency Status devDependencies Status

HLTV logo
The unofficial HLTV Node.js API

Table of contents

Installation

NPM

Usage

import HLTV from 'hltv'
// Or if you're stuck with CommonJS
const { HLTV } = require('hltv')

Configuration

You can create an instance of HLTV with a custom config.

const myHLTV = HLTV.createInstance({hltvUrl: 'my-proxy-server'})

See config schema

API

getMatch

Parses most information from a match page

Option Type Default value Description
id int - The match id
HLTV.getMatch({id: 2306295}).then(res => {
    ...
})

See schema


getMatches

Parses all matches from the hltv.org/matches/ page

Option Type Default Value Description
- - - -
HLTV.getMatches().then((res) => {
  ...
})

See schema for Live Matches

See schema for Upcoming Matches


getMatchesStats

Parses all matches from the hltv.org/stats/matches page

Option Type Default Value Description
startDate string? - -
endDate string? - -
matchType MatchType? - -
maps Map[]? - -
HLTV.getMatchesStats({startDate: '2017-07-10', endDate: '2017-07-18'}).then((res) => {
  ...
})

See schema


getMatchMapStats

Parses info from the single map stats page (hltv.org/stats/matches/mapstatsid/*/*)

Option Type Default Value Description
id number - -
HLTV.getMatchMapStats({id: 49968}).then((res) => {
  ...
})

See schema


getResults

Parses all matches from the hltv.org/results/ page

Option Type Default Value Description
pages int 1 Number of pages with results to be parsed
HLTV.getResults({pages: 2}).then((res) => {
  ...
})

See schema


getStreams

Parses all streams present on the front page of HLTV

Option Type Default Value Description
loadLinks boolean false Enables parsing of the stream links. Its an option since it can slow down the response (every stream is a separate request).
HLTV.getStreams().then((res) => {
  ...
})

See schema


getRecentThreads

Parses the latest threads on the front page of HLTV

Option Type Default Value Description
- - - -
HLTV.getRecentThreads().then((res) => {
  ...
})

See schema

getTeamRanking

Parses the info from the hltv.org/ranking/teams/ page

Option Type Default Value Description
year string - -
month string - Must be lowercase and in MMMM format
day string - -
country string - Must be capitalized ('Brazil', 'France' etc)
// If you don't provide a filter the latest ranking will be parsed
HLTV.getTeamRanking()
HLTV.getTeamRanking({country: 'Thailand'})
HLTV.getTeamRanking({year: '2017', month: 'may', day: '29'}).then((res) => {
  ...
})

See schema


getTeam

Parses the info from the hltv.org/team/ page

Option Type Default value Description
id int - The team id
HLTV.getTeam({id: 6137}).then(res => {
    ...
})

See schema


getTeamStats

Parses the info from the hltv.org/stats/teams/ page

Option Type Default value Description
id int - The team id
HLTV.getTeamStats({id: 6137}).then(res => {
    ...
})

See schema


getPlayer

Parses the info from the hltv.org/player/ page

Option Type Default value Description
id int - The player id
HLTV.getPlayer({id: 6137}).then(res => {
    ...
})

See schema


connectToScorebot

Presents an interface to receive data when the HLTV scorebot updates

NOTE: While connectToScorebot returns a Promise, the promise will never resolve. Instead you should pass the callbacks described below.

Option Type Default Value Description
id int - The match ID
onScoreboardUpdate function? - Callback that is called when there is new scoreboard data
onLogUpdate function? - Callback that is called when there is new game log data
onConnect function? - Callback that is called when a connection with the scorebot is established
onDisconnect function? - Callback that is called when the scorebot disconnects
HLTV.connectToScorebot({id: 2311609, onScoreboardUpdate: (data) => {
    ...
}, onLogUpdate: (data) => {
    ...
}})

The onLogUpdate callback is passed an LogUpdate object

The onScoreboardUpdate callback is passed an ScoreboardUpdate object

hltv's People

Contributors

gigobyte avatar lactuk avatar redzumi avatar morb0 avatar throwsexception avatar

Watchers

James Cloos avatar Rachindra Poudel avatar

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.