The unofficial HLTV Node.js API
#Table of contents
Installation
Usage
import HLTV from 'hltv'
const HLTV = require('hltv')
const hltv = new HLTV()
API
getMatch
Parses most information from a match page
Option | Type | Default value | Description |
---|
id | string | - | The match id |
hltv.getMatch({id: '2306295-sk-natus-vincere-eleague-season-2'}).then(res => {
...
})
Results in an object with the following schema:
Property | Type | Note |
---|
team1 | string | |
team1Id | int | |
team2 | string | |
team2Id | int | |
date | string | e.g. "12th of November 2016 22:30" |
format | string | |
additionalInfo | string | e.g. "* Grand final" |
event | object | Object schema: {name: string, link: string} |
maps | [objects] | Object schema: {name: string, result: string} |
demos | [objects] | Object schema: {name: string, link: string} |
highlights | array | |
players | array | |
getMatches
Parses all matches from the hltv.org/matches/
page
Option | Type | Default Value | Description |
---|
hltv.getMatches().then((res) => {
...
})
Results in an array of objects with the following schema:
Property | Type | Note |
---|
time | string | Will be undefined if the match is live or finished |
team1 | string | |
team1Id | int | |
team2 | string | |
team2Id | int | |
map | string | Only exists if the match is BO1 |
format | string | |
label | string | Mainly used when the teams are still unknown (e.g. "iBP Masters Grand Final") |
id | string | |
live | boolean | |
finished | boolean | |
getLatestResults
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.getLatestResults({pages: 2}).then((res) => {
...
})
Results in an array of objects with the following schema:
Property | Type | Note |
---|
result | string | e.g. "2 - 0" or "16 - 9" |
team1 | string | |
team1Id | int | |
team2 | string | |
team2Id | int | |
map | string | Only exists if the match is BO1 |
format | string | |
id | string | |
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) => {
...
})
Results in an array of objects with the following schema:
Property | Type | Note |
---|
name | string | |
category | string | e.g. "Caster" or "Female player" |
country | string | An ISO 3166 code |
hltvLink | string | |
realLink | string | Only if the loadLinks flag is enabled |
viewers | int | |