Comparing version 3.1.0 to 3.2.0
@@ -7,2 +7,9 @@ import { HLTVConfig } from '../config'; | ||
import { MatchFormat, MatchFormatLocation } from '../shared/MatchFormat'; | ||
export declare enum MatchStatus { | ||
Live = "Live", | ||
Postponed = "Postponed", | ||
Over = "Over", | ||
Scheduled = "Scheduled", | ||
Deleted = "Deleted" | ||
} | ||
export interface Demo { | ||
@@ -57,2 +64,3 @@ name: string; | ||
date?: number; | ||
significance?: string; | ||
format?: { | ||
@@ -85,11 +93,4 @@ type: MatchFormat; | ||
} | ||
export declare enum MatchStatus { | ||
Live = "Live", | ||
Postponed = "Postponed", | ||
Over = "Over", | ||
Scheduled = "Scheduled", | ||
Deleted = "Deleted" | ||
} | ||
export declare const getMatch: (config: HLTVConfig) => ({ id }: { | ||
id: number; | ||
}) => Promise<FullMatch>; |
@@ -55,3 +55,3 @@ "use strict"; | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
var $, _b, title, date, format, status, hasScorebot, statsId, team1, team2, vetoes, event, odds, oddsCommunity, maps, players, streams, demos, highlightedPlayers, headToHead, highlights, playerOfTheMatch, winnerTeam; | ||
var $, _b, title, date, format, significance, status, hasScorebot, statsId, team1, team2, vetoes, event, odds, oddsCommunity, maps, players, streams, demos, highlightedPlayers, headToHead, highlights, playerOfTheMatch, winnerTeam; | ||
return __generator(this, function (_c) { | ||
@@ -67,2 +67,3 @@ switch (_c.label) { | ||
format = getFormat($); | ||
significance = getMatchSignificance($); | ||
status = getMatchStatus($); | ||
@@ -89,2 +90,3 @@ hasScorebot = $('#scoreboardElement').exists(); | ||
statsId: statsId, | ||
significance: significance, | ||
team1: team1, | ||
@@ -189,3 +191,8 @@ team2: team2, | ||
return { | ||
provider: providerUrl.hostname, | ||
provider: providerUrl.hostname | ||
.split('.') | ||
.reverse() | ||
.splice(0, 2) | ||
.reverse() | ||
.join('.'), | ||
team1: convertOdds ? utils_1.percentageToDecimalOdd(oddTeam1) : oddTeam1, | ||
@@ -394,11 +401,19 @@ team2: convertOdds ? utils_1.percentageToDecimalOdd(oddTeam2) : oddTeam2 | ||
function getFormat($) { | ||
var _a; | ||
if (!$('.preformatted-text').exists()) { | ||
return; | ||
} | ||
var _b = $('.preformatted-text').lines()[0].split(' ('), format = _b[0], location = _b[1]; | ||
var _a = $('.preformatted-text') | ||
.lines()[0] | ||
.split(' (') | ||
.map(function (x) { return x.trim(); }), format = _a[0], location = _a[1]; | ||
return { | ||
type: MatchFormat_1.fromFullMatchFormat(format.trim()), | ||
location: (_a = location === null || location === void 0 ? void 0 : location.trim()) === null || _a === void 0 ? void 0 : _a.substring(0, location.length - 1) | ||
type: MatchFormat_1.fromFullMatchFormat(format), | ||
location: location === null || location === void 0 ? void 0 : location.substring(0, location.length - 1) | ||
}; | ||
} | ||
function getMatchSignificance($) { | ||
var _a; | ||
var additionalInfo = $('.preformatted-text').lines(); | ||
return (_a = additionalInfo | ||
.find(function (x) { return x.startsWith('*'); })) === null || _a === void 0 ? void 0 : _a.slice(1).trim(); | ||
} |
@@ -288,5 +288,3 @@ "use strict"; | ||
}, {}); | ||
var playerOverviewStats = m$('.stats-table tbody tr') | ||
.toArray() | ||
.map(function (el) { | ||
var getPlayerOverviewStats = function (el) { | ||
var id = el.find('.st-player a').attrThen('href', utils_1.getIdAt(3)); | ||
@@ -303,6 +301,14 @@ var performanceStats = playerPerformanceStats[id]; | ||
: { rating1: rating })), performanceStats); | ||
}); | ||
}; | ||
return { | ||
team1: playerOverviewStats.slice(0, 5), | ||
team2: playerOverviewStats.slice(5) | ||
team1: m$('.stats-table') | ||
.first() | ||
.find('tbody tr') | ||
.toArray() | ||
.map(getPlayerOverviewStats), | ||
team2: m$('.stats-table') | ||
.last() | ||
.find('tbody tr') | ||
.toArray() | ||
.map(getPlayerOverviewStats) | ||
}; | ||
@@ -309,0 +315,0 @@ } |
{ | ||
"name": "hltv", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "The unofficial HLTV Node.js API", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -485,3 +485,3 @@ [![Dependency Status](https://david-dm.org/gigobyte/hltv.svg)](https://david-dm.org/gigobyte/hltv) | ||
**[See schema](https://github.com/gigobyte/HLTV/blob/master/src/endpoints/getEvents.ts#L8)** | ||
**[See schema](https://github.com/gigobyte/HLTV/blob/master/src/endpoints/getResults.ts#L31)** | ||
@@ -488,0 +488,0 @@ #### connectToScorebot |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
259070
4757