Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hltv

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hltv - npm Package Compare versions

Comparing version 2.14.3 to 2.15.0

lib/endpoints/getEvents.d.ts

15

lib/endpoints/getResults.d.ts
import { MatchResult } from '../models/MatchResult';
import { HLTVConfig } from '../config';
export declare const getResults: (config: HLTVConfig) => ({ pages, eventId }: {
pages: number;
eventId?: number | undefined;
}) => Promise<MatchResult[]>;
declare type GetResultsArguments = {
pages?: number;
teamID?: number;
eventID?: never;
} | {
pages?: never;
teamID?: number;
eventID?: number;
};
export declare const getResults: (config: HLTVConfig) => ({ pages, teamID, eventID }: GetResultsArguments) => Promise<MatchResult[]>;
export {};

@@ -42,3 +42,3 @@ "use strict";

exports.getResults = function (config) { return function (_a) {
var _b = _a.pages, pages = _b === void 0 ? 1 : _b, eventId = _a.eventId;
var _b = _a.pages, pages = _b === void 0 ? 1 : _b, teamID = _a.teamID, eventID = _a.eventID;
return __awaiter(_this, void 0, void 0, function () {

@@ -53,16 +53,14 @@ var matches, _loop_1, i;

}
if (eventId) {
pages = 1;
}
matches = [];
_loop_1 = function (i) {
var fullUrl, $;
var url, $;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
fullUrl = config.hltvUrl + "/results?offset=" + i * 100;
if (eventId) {
fullUrl += "&event=" + eventId;
}
return [4, mappers_1.fetchPage(fullUrl, config.loadPage)];
url = config.hltvUrl + "/results?offset=" + i * 100;
if (teamID)
url += "&team=" + teamID;
if (eventID)
url += "&event=" + eventID;
return [4, mappers_1.fetchPage(url, config.loadPage)];
case 1:

@@ -89,15 +87,18 @@ $ = _a.sent();

var _a = mappers_1.getMatchFormatAndMap(matchEl.find('.map-text').text()), map = _a.map, format = _a.format;
var idOfEvent = typeof eventID === 'undefined'
? parsing_1.popSlashSource(matchEl.find('.event-logo')).split('.')[0]
: eventID;
var nameOfEvent = typeof eventID === 'undefined'
? matchEl.find('.event-logo').attr('alt')
: $('.eventname').text();
var event = {
name: eventId ? $('.eventname').text() : matchEl.find('.event-logo').attr('alt'),
id: eventId
? eventId
: Number(parsing_1.popSlashSource(matchEl.find('.event-logo')).split('.')[0])
name: nameOfEvent,
id: Number(idOfEvent)
};
var date = Number(eventId
? matchEl
.find('.date-cell')
.children()
var eventDate = typeof eventID === 'undefined'
? matchEl.parent().attr('data-zonedgrouping-entry-unix')
: $('.eventdate span')
.first()
.attr('data-unix')
: matchEl.parent().attr('data-zonedgrouping-entry-unix'));
.data('unix');
var date = Number(eventDate);
return { id: id, team1: team1, team2: team2, result: result, event: event, map: map, format: format, stars: stars, date: date };

@@ -104,0 +105,0 @@ }));

@@ -5,3 +5,4 @@ export declare enum MatchStatus {

Over = "Match over",
Scheduled = "Scheduled"
Scheduled = "Scheduled",
Deleted = "Match deleted"
}

@@ -9,2 +9,3 @@ "use strict";

MatchStatus["Scheduled"] = "Scheduled";
MatchStatus["Deleted"] = "Match deleted";
})(MatchStatus = exports.MatchStatus || (exports.MatchStatus = {}));

@@ -8,2 +8,3 @@ import { HLTVConfig } from './config';

import { ThreadCategory } from './enums/ThreadCategory';
import { EventSize } from './enums/EventSize';
import { WinType } from './enums/WinType';

@@ -26,5 +27,10 @@ export declare class HLTVFactory {

getRecentThreads: () => Promise<import("./models/Thread").Thread[]>;
getResults: ({ pages, eventId }: {
pages: number;
eventId?: number | undefined;
getResults: ({ pages, teamID, eventID }: {
pages?: number | undefined;
teamID?: number | undefined;
eventID?: undefined;
} | {
pages?: undefined;
teamID?: number | undefined;
eventID?: number | undefined;
}) => Promise<import("./models/MatchResult").MatchResult[]>;

@@ -52,2 +58,6 @@ getStreams: ({ loadLinks }?: {

}) => Promise<import("./models/FullEvent").FullEvent>;
getEvents: ({ size, month }?: {
size?: EventSize | undefined;
month?: Number | undefined;
}) => Promise<import("./models/EventResult").EventResult[]>;
getPlayerStats: ({ id, startDate, endDate, matchType, rankingFilter }: {

@@ -70,2 +80,2 @@ id: number;

export default hltvInstance;
export { hltvInstance as HLTV, MapSlug, Map, MatchType, RankingFilter, StreamCategory, ThreadCategory, WinType };
export { hltvInstance as HLTV, MapSlug, Map, MatchType, RankingFilter, StreamCategory, ThreadCategory, WinType, EventSize };

@@ -22,2 +22,3 @@ "use strict";

exports.MapSlug = MapSlug_1.MapSlug;
var getEvents_1 = require("./endpoints/getEvents");
var HLTVFactory = (function () {

@@ -40,2 +41,3 @@ function HLTVFactory(config) {

this.getEvent = getEvent_1.getEvent(this.config);
this.getEvents = getEvents_1.getEvents(this.config);
this.getPlayerStats = getPlayerStats_1.getPlayerStats(this.config);

@@ -42,0 +44,0 @@ this.getPlayerRanking = getPlayerRanking_1.getPlayerRanking(this.config);

{
"name": "hltv",
"version": "2.14.3",
"version": "2.15.0",
"description": "The unofficial HLTV Node.js API",

@@ -57,3 +57,3 @@ "main": "lib/index.js",

"ts-node": "^8.0.2",
"typescript": "^3.0.1"
"typescript": "^3.5.2"
},

@@ -60,0 +60,0 @@ "dependencies": {

@@ -30,2 +30,3 @@ [![Dependency Status](https://david-dm.org/gigobyte/hltv.svg)](https://david-dm.org/gigobyte/hltv)

- [getPlayerRanking](#getplayerranking)
- [getEvents](#getevents)
- [getEvent](#getevent)

@@ -162,4 +163,8 @@ - [connectToScorebot](#connecttoscorebot)

pages | int | 1 | Number of pages with results to be parsed |
teamID | int? | - | ID of specific team |
eventID | int? | - | ID of specific event |
```javascript
// Note: if you pass `eventID` to getResults you cannot pass a `pages` parameter
// since HLTV doesn't have pages for the event filter.
HLTV.getResults({pages: 2}).then((res) => {

@@ -330,2 +335,20 @@ ...

### getEvents
Parses the info from the `hltv.org/events` page
Option | Type | Default value | Description |
:---:|:---:|:---:|:---:|
size | [EventSize?](https://github.com/gigobyte/HLTV/blob/master/src/enums/EventSize.ts)? | - | Event size type. (EventSize.Small, EventSize.Big). Default (empty) combines both.
```javascript
HLTV.getEvents().then(res => {
...
})
```
**[See schema](https://github.com/gigobyte/HLTV/blob/master/src/models/EventResult.ts)**
***
### getEvent

@@ -332,0 +355,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc