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.2 to 2.14.3

lib/enums/MatchStatus.d.ts

13

lib/endpoints/getMatch.js

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

Object.defineProperty(exports, "__esModule", { value: true });
var MatchStatus_1 = require("../enums/MatchStatus");
var parsing_1 = require("../utils/parsing");

@@ -45,3 +46,3 @@ var mappers_1 = require("../utils/mappers");

return __awaiter(_this, void 0, void 0, function () {
var $, title, date, format, additionalInfo, live, hasScorebot, teamEls, team1, team2, winnerTeam, vetoes, event, odds, oddsCommunity, maps, players, streams, demos, highlightedPlayerLink, highlightedPlayer, headToHead, highlights;
var $, title, date, format, additionalInfo, status, live, hasScorebot, teamEls, team1, team2, winnerTeam, vetoes, event, odds, oddsCommunity, maps, players, streams, demos, highlightedPlayerLink, highlightedPlayer, headToHead, highlights;
return __generator(this, function (_b) {

@@ -65,3 +66,10 @@ switch (_b.label) {

.trim();
live = $('.countdown').text() === 'LIVE';
status = MatchStatus_1.MatchStatus.Scheduled;
if (!$('.countdown').attr('data-time-countdown')) {
status = $('.countdown').text();
}
else if ($('.countdown').text() === MatchStatus_1.MatchStatus.Live) {
status = MatchStatus_1.MatchStatus.Live;
}
live = status === MatchStatus_1.MatchStatus.Live;
hasScorebot = $('#scoreboardElement').length !== 0;

@@ -268,2 +276,3 @@ teamEls = $('div.teamName');

live: live,
status: status,
title: title,

@@ -270,0 +279,0 @@ hasScorebot: hasScorebot,

5

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

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

exports.getResults = function (config) { return function (_a) {
var _b = (_a === void 0 ? {} : _a).pages, pages = _b === void 0 ? 1 : _b;
var _b = _a.pages, pages = _b === void 0 ? 1 : _b, eventId = _a.eventId;
return __awaiter(_this, void 0, void 0, function () {
var matches, i, $;
var matches, _loop_1, i;
return __generator(this, function (_c) {

@@ -53,3 +53,56 @@ switch (_c.label) {

}
if (eventId) {
pages = 1;
}
matches = [];
_loop_1 = function (i) {
var fullUrl, $;
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)];
case 1:
$ = _a.sent();
matches = matches.concat(mappers_1.toArray($('.results-holder > .results-all > .results-sublist .result-con .a-reset')).map(function (matchEl) {
var id = Number(matchEl.attr('href').split('/')[2]);
var stars = matchEl.find('.stars i').length;
var team1 = {
id: Number(parsing_1.popSlashSource(matchEl.find('img.team-logo').first())),
name: matchEl
.find('div.team')
.first()
.text()
};
var team2 = {
id: Number(parsing_1.popSlashSource(matchEl.find('img.team-logo').last())),
name: matchEl
.find('div.team')
.last()
.text()
};
var result = matchEl.find('.result-score').text();
var _a = mappers_1.getMatchFormatAndMap(matchEl.find('.map-text').text()), map = _a.map, format = _a.format;
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])
};
var date = Number(eventId
? matchEl
.find('.date-cell')
.children()
.first()
.attr('data-unix')
: matchEl.parent().attr('data-zonedgrouping-entry-unix'));
return { id: id, team1: team1, team2: team2, result: result, event: event, map: map, format: format, stars: stars, date: date };
}));
return [2];
}
});
};
i = 0;

@@ -59,31 +112,5 @@ _c.label = 1;

if (!(i < pages)) return [3, 4];
return [4, mappers_1.fetchPage(config.hltvUrl + "/results?offset=" + i * 100, config.loadPage)];
return [5, _loop_1(i)];
case 2:
$ = _c.sent();
matches = matches.concat(mappers_1.toArray($('.results-holder > .results-all > .results-sublist .result-con .a-reset')).map(function (matchEl) {
var id = Number(matchEl.attr('href').split('/')[2]);
var stars = matchEl.find('.stars i').length;
var team1 = {
id: Number(parsing_1.popSlashSource(matchEl.find('img.team-logo').first())),
name: matchEl
.find('div.team')
.first()
.text()
};
var team2 = {
id: Number(parsing_1.popSlashSource(matchEl.find('img.team-logo').last())),
name: matchEl
.find('div.team')
.last()
.text()
};
var result = matchEl.find('.result-score').text();
var _a = mappers_1.getMatchFormatAndMap(matchEl.find('.map-text').text()), map = _a.map, format = _a.format;
var event = {
name: matchEl.find('.event-logo').attr('alt'),
id: Number(parsing_1.popSlashSource(matchEl.find('.event-logo')).split('.')[0])
};
var date = Number(matchEl.parent().attr('data-zonedgrouping-entry-unix'));
return { id: id, team1: team1, team2: team2, result: result, event: event, map: map, format: format, stars: stars, date: date };
}));
_c.sent();
_c.label = 3;

@@ -90,0 +117,0 @@ case 3:

@@ -25,4 +25,5 @@ import { HLTVConfig } from './config';

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

@@ -29,0 +30,0 @@ getStreams: ({ loadLinks }?: {

@@ -0,1 +1,2 @@

import { MatchStatus } from './../enums/MatchStatus';
import { Team } from './Team';

@@ -30,2 +31,3 @@ import { Event } from './Event';

readonly live: boolean;
readonly status: MatchStatus;
readonly hasScorebot: boolean;

@@ -32,0 +34,0 @@ readonly highlightedPlayer?: Player;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require("./index");
index_1.default.getMatch({ id: 2332676 })
.then(function (res) { return console.dir(res, { depth: null }); })
.catch(function (err) { return console.log(err); });
{
"name": "hltv",
"version": "2.14.2",
"version": "2.14.3",
"description": "The unofficial HLTV Node.js API",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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

You can create an instance of HLTV with a custom config.
You can create an instance of HLTV with a custom config if you want to.
```javascript
const myHLTV = HLTV.createInstance({hltvUrl: 'my-proxy-server', loadPage: /* my custom request library */})
const myHLTV = HLTV.createInstance({hltvUrl: /* my-proxy-server */, loadPage: /* my custom request library */})
```

@@ -57,0 +57,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