Package Exports
- hltv
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hltv) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
The unofficial HLTV Node.js API
Installation
Usage
import HLTV from 'hltv'
// Or if you're stuck with CommonJS
const HLTV = require('hltv')
//create an object before using the API
const hltv = new HLTV()API
getMatches
Parses all matches from the hltv.org/matches/ page
| Option | Type | Default Value | Description |
|---|
- | - | - | - |
hltv.getMatches().then((res) => {
...
})The callback receives 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 | string | |
| team2 | string | |
| team2Id | string | |
| 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) => {
...
})The callback receives an array of objects with the following schema:
| Property | Type | Note |
|---|---|---|
| result | string | e.g. '2 - 0' or '16 - 9' |
| team1 | string | |
| team1Id | string | |
| team2 | string | |
| team2Id | string | |
| map | string | Only exists if the match is BO1 |
| format | string | |
| id | string |
