Comparing version 2.22.2 to 2.23.0
@@ -6,5 +6,5 @@ "use strict"; | ||
var mappers_1 = require("../utils/mappers"); | ||
exports.connectToScorebot = function (config) { return function (_a) { | ||
var connectToScorebot = function (config) { return function (_a) { | ||
var id = _a.id, onScoreboardUpdate = _a.onScoreboardUpdate, onLogUpdate = _a.onLogUpdate, onFullLogUpdate = _a.onFullLogUpdate, onConnect = _a.onConnect, onDisconnect = _a.onDisconnect; | ||
mappers_1.fetchPage(config.hltvUrl + "/matches/" + id + "/-", config.loadPage).then(function ($) { | ||
mappers_1.fetchPage(config.hltvUrl + "/matches/" + id + "/" + mappers_1.generateRandomSuffix(), config.loadPage).then(function ($) { | ||
var url = $('#scoreboardElement') | ||
@@ -22,2 +22,3 @@ .attr('data-scorebot-url') | ||
}); | ||
var reconnected = false; | ||
socket.on('connect', function () { | ||
@@ -28,3 +29,5 @@ var done = function () { return socket.close(); }; | ||
} | ||
socket.emit('readyForMatch', initObject); | ||
if (!reconnected) { | ||
socket.emit('readyForMatch', initObject); | ||
} | ||
socket.on('scoreboard', function (data) { | ||
@@ -47,2 +50,3 @@ if (onScoreboardUpdate) { | ||
socket.on('reconnect', function () { | ||
reconnected = true; | ||
socket.emit('readyForMatch', initObject); | ||
@@ -57,1 +61,2 @@ }); | ||
}; }; | ||
exports.connectToScorebot = connectToScorebot; |
@@ -43,3 +43,3 @@ "use strict"; | ||
var checkForRateLimiting_1 = require("../utils/checkForRateLimiting"); | ||
exports.getEvent = function (config) { return function (_a) { | ||
var getEvent = function (config) { return function (_a) { | ||
var id = _a.id; | ||
@@ -50,3 +50,3 @@ return __awaiter(void 0, void 0, void 0, function () { | ||
switch (_b.label) { | ||
case 0: return [4, mappers_1.fetchPage(config.hltvUrl + "/events/" + id + "/-", config.loadPage)]; | ||
case 0: return [4, mappers_1.fetchPage(config.hltvUrl + "/events/" + id + "/" + mappers_1.generateRandomSuffix(), config.loadPage)]; | ||
case 1: | ||
@@ -124,1 +124,2 @@ $ = _b.sent(); | ||
}; }; | ||
exports.getEvent = getEvent; |
@@ -45,3 +45,3 @@ "use strict"; | ||
var checkForRateLimiting_1 = require("../utils/checkForRateLimiting"); | ||
exports.getEvents = function (config) { return function (_a) { | ||
var getEvents = function (config) { return function (_a) { | ||
var _b = _a === void 0 ? {} : _a, size = _b.size, month = _b.month; | ||
@@ -87,2 +87,3 @@ return __awaiter(void 0, void 0, void 0, function () { | ||
}; }; | ||
exports.getEvents = getEvents; | ||
var parseEvents = function (eventsToParse, size) { | ||
@@ -89,0 +90,0 @@ var dateSelector, nameSelector, locationSelector; |
@@ -50,3 +50,3 @@ "use strict"; | ||
}; | ||
exports.getMatch = function (config) { return function (_a) { | ||
var getMatch = function (config) { return function (_a) { | ||
var id = _a.id; | ||
@@ -57,3 +57,3 @@ return __awaiter(void 0, void 0, void 0, function () { | ||
switch (_b.label) { | ||
case 0: return [4, mappers_1.fetchPage(config.hltvUrl + "/matches/" + id + "/-", config.loadPage)]; | ||
case 0: return [4, mappers_1.fetchPage(config.hltvUrl + "/matches/" + id + "/" + mappers_1.generateRandomSuffix(), config.loadPage)]; | ||
case 1: | ||
@@ -138,12 +138,10 @@ $ = _b.sent(); | ||
}); | ||
if ($('.pick-a-winner-team').length == 2) { | ||
if ($('.pick-a-winner').length > 0) { | ||
oddsCommunity = { | ||
team1: parsing_1.percentageToDecimalOdd(Number($('.pick-a-winner-team') | ||
team1: parsing_1.percentageToDecimalOdd(Number($('.pick-a-winner-team.team1>.percentage') | ||
.first() | ||
.find('.percentage') | ||
.text() | ||
.replace('%', ''))), | ||
team2: parsing_1.percentageToDecimalOdd(Number($('.pick-a-winner-team') | ||
.last() | ||
.find('.percentage') | ||
team2: parsing_1.percentageToDecimalOdd(Number($('.pick-a-winner-team.team2>.percentage') | ||
.first() | ||
.text() | ||
@@ -284,1 +282,2 @@ .replace('%', ''))) | ||
}; }; | ||
exports.getMatch = getMatch; |
@@ -50,3 +50,3 @@ "use strict"; | ||
var checkForRateLimiting_1 = require("../utils/checkForRateLimiting"); | ||
exports.getMatches = function (config) { return function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var getMatches = function (config) { return function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var $, liveMatches, upcomingMatches; | ||
@@ -119,1 +119,2 @@ return __generator(this, function (_a) { | ||
}); }; }; | ||
exports.getMatches = getMatches; |
@@ -49,3 +49,3 @@ "use strict"; | ||
var checkForRateLimiting_1 = require("../utils/checkForRateLimiting"); | ||
exports.getMatchesStats = function (config) { return function (_a) { | ||
var getMatchesStats = function (config) { return function (_a) { | ||
var _b = _a === void 0 ? {} : _a, startDate = _b.startDate, endDate = _b.endDate, matchType = _b.matchType, _c = _b.maps, maps = _c === void 0 ? [] : _c, rankingFilter = _b.rankingFilter; | ||
@@ -113,1 +113,2 @@ return __awaiter(void 0, void 0, void 0, function () { | ||
}; }; | ||
exports.getMatchesStats = getMatchesStats; |
@@ -54,3 +54,3 @@ "use strict"; | ||
var checkForRateLimiting_1 = require("../utils/checkForRateLimiting"); | ||
exports.getMatchMapStats = function (config) { return function (_a) { | ||
var getMatchMapStats = function (config) { return function (_a) { | ||
var id = _a.id; | ||
@@ -198,1 +198,2 @@ return __awaiter(void 0, void 0, void 0, function () { | ||
}; }; | ||
exports.getMatchMapStats = getMatchMapStats; |
@@ -53,3 +53,3 @@ "use strict"; | ||
var checkForRateLimiting_1 = require("../utils/checkForRateLimiting"); | ||
exports.getMatchStats = function (config) { return function (_a) { | ||
var getMatchStats = function (config) { return function (_a) { | ||
var id = _a.id; | ||
@@ -82,3 +82,3 @@ return __awaiter(void 0, void 0, void 0, function () { | ||
}; | ||
return [4, mappers_1.fetchPage(config.hltvUrl + "/stats/matches/" + id + "/-", config.loadPage)]; | ||
return [4, mappers_1.fetchPage(config.hltvUrl + "/stats/matches/" + id + "/" + mappers_1.generateRandomSuffix(), config.loadPage)]; | ||
case 1: | ||
@@ -165,1 +165,2 @@ $ = _b.sent(); | ||
}; }; | ||
exports.getMatchStats = getMatchStats; |
@@ -42,3 +42,3 @@ "use strict"; | ||
var checkForRateLimiting_1 = require("../utils/checkForRateLimiting"); | ||
exports.getOngoingEvents = function (config) { return function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var getOngoingEvents = function (config) { return function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var $, ongoingEventsToday, featuredEvents, ongoingEvents; | ||
@@ -78,1 +78,2 @@ return __generator(this, function (_a) { | ||
}); }; }; | ||
exports.getOngoingEvents = getOngoingEvents; |
@@ -43,3 +43,3 @@ "use strict"; | ||
var checkForRateLimiting_1 = require("../utils/checkForRateLimiting"); | ||
exports.getPlayer = function (config) { return function (_a) { | ||
var getPlayer = function (config) { return function (_a) { | ||
var id = _a.id; | ||
@@ -50,3 +50,3 @@ return __awaiter(void 0, void 0, void 0, function () { | ||
switch (_b.label) { | ||
case 0: return [4, mappers_1.fetchPage(config.hltvUrl + "/player/" + id + "/-", config.loadPage)]; | ||
case 0: return [4, mappers_1.fetchPage(config.hltvUrl + "/player/" + id + "/" + mappers_1.generateRandomSuffix(), config.loadPage)]; | ||
case 1: | ||
@@ -138,1 +138,2 @@ $ = _b.sent(); | ||
}; }; | ||
exports.getPlayer = getPlayer; |
@@ -41,3 +41,3 @@ "use strict"; | ||
var index_1 = require("../index"); | ||
exports.getPlayerByName = function (config) { return function (_a) { | ||
var getPlayerByName = function (config) { return function (_a) { | ||
var name = _a.name; | ||
@@ -59,1 +59,2 @@ return __awaiter(void 0, void 0, void 0, function () { | ||
}; }; | ||
exports.getPlayerByName = getPlayerByName; |
@@ -7,11 +7,11 @@ import { PlayerRanking } from '../models/PlayerRanking'; | ||
import { BestOfFilter } from '../enums/BestOfFilter'; | ||
export declare const getPlayerRanking: (config: HLTVConfig) => ({ startDate, endDate, matchType, rankingFilter, maps, minMapCount, country, bestOfX }: { | ||
startDate?: string | undefined; | ||
endDate?: string | undefined; | ||
matchType?: MatchType | undefined; | ||
rankingFilter?: RankingFilter | undefined; | ||
maps?: Map[] | undefined; | ||
minMapCount?: number | undefined; | ||
country?: string[] | undefined; | ||
bestOfX?: BestOfFilter | undefined; | ||
export declare const getPlayerRanking: (config: HLTVConfig) => (options?: { | ||
startDate?: string; | ||
endDate?: string; | ||
matchType?: MatchType; | ||
rankingFilter?: RankingFilter; | ||
maps?: Map[]; | ||
minMapCount?: number; | ||
country?: string[]; | ||
bestOfX?: BestOfFilter; | ||
}) => Promise<PlayerRanking[]>; |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -43,22 +54,13 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
var checkForRateLimiting_1 = require("../utils/checkForRateLimiting"); | ||
exports.getPlayerRanking = function (config) { return function (_a) { | ||
var startDate = _a.startDate, endDate = _a.endDate, matchType = _a.matchType, rankingFilter = _a.rankingFilter, maps = _a.maps, minMapCount = _a.minMapCount, country = _a.country, bestOfX = _a.bestOfX; | ||
var getPlayerRanking = function (config) { return function (options) { | ||
if (options === void 0) { options = {}; } | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
var query, $; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
query = querystring_1.stringify({ | ||
startDate: startDate, | ||
endDate: endDate, | ||
matchType: matchType, | ||
rankingFilter: rankingFilter, | ||
maps: maps, | ||
minMapCount: minMapCount, | ||
country: country, | ||
bestOfX: bestOfX | ||
}); | ||
query = querystring_1.stringify(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, (options.startDate ? { startDate: options.startDate } : {})), (options.endDate ? { endDate: options.endDate } : {})), (options.matchType ? { matchType: options.matchType } : {})), (options.rankingFilter ? { rankingFilter: options.rankingFilter } : {})), (options.maps ? { maps: options.maps } : {})), (options.minMapCount ? { minMapCount: options.minMapCount } : {})), (options.country ? { country: options.country } : {})), (options.bestOfX ? { bestOfX: options.bestOfX } : {}))); | ||
return [4, mappers_1.fetchPage(config.hltvUrl + "/stats/players?" + query, config.loadPage)]; | ||
case 1: | ||
$ = _b.sent(); | ||
$ = _a.sent(); | ||
checkForRateLimiting_1.checkForRateLimiting($); | ||
@@ -103,1 +105,2 @@ return [2, mappers_1.toArray($('.player-ratings-table tbody tr')).map(function (playerRow) { | ||
}; }; | ||
exports.getPlayerRanking = getPlayerRanking; |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -44,3 +55,3 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
var checkForRateLimiting_1 = require("../utils/checkForRateLimiting"); | ||
exports.getPlayerStats = function (config) { return function (_a) { | ||
var getPlayerStats = function (config) { return function (_a) { | ||
var id = _a.id, startDate = _a.startDate, endDate = _a.endDate, matchType = _a.matchType, rankingFilter = _a.rankingFilter; | ||
@@ -52,9 +63,4 @@ return __awaiter(void 0, void 0, void 0, function () { | ||
case 0: | ||
query = querystring_1.stringify({ | ||
startDate: startDate, | ||
endDate: endDate, | ||
matchType: matchType, | ||
rankingFilter: rankingFilter | ||
}); | ||
return [4, mappers_1.fetchPage(config.hltvUrl + "/stats/players/" + id + "/-?" + query, config.loadPage)]; | ||
query = querystring_1.stringify(__assign(__assign(__assign(__assign({}, (startDate ? { startDate: startDate } : {})), (endDate ? { endDate: endDate } : {})), (matchType ? { matchType: matchType } : {})), (rankingFilter ? { rankingFilter: rankingFilter } : {}))); | ||
return [4, mappers_1.fetchPage(config.hltvUrl + "/stats/players/" + id + "/" + mappers_1.generateRandomSuffix() + "?" + query, config.loadPage)]; | ||
case 1: | ||
@@ -104,1 +110,2 @@ $ = _b.sent(); | ||
}; }; | ||
exports.getPlayerStats = getPlayerStats; |
@@ -41,3 +41,3 @@ "use strict"; | ||
var mappers_1 = require("../utils/mappers"); | ||
exports.getRecentThreads = function (config) { return function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var getRecentThreads = function (config) { return function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var $, threads; | ||
@@ -64,1 +64,2 @@ return __generator(this, function (_a) { | ||
}); }; }; | ||
exports.getRecentThreads = getRecentThreads; |
@@ -42,3 +42,3 @@ "use strict"; | ||
var mappers_1 = require("../utils/mappers"); | ||
exports.getResults = function (config) { return function (_a) { | ||
var getResults = function (config) { return function (_a) { | ||
var _b = _a.startPage, startPage = _b === void 0 ? 0 : _b, _c = _a.endPage, endPage = _c === void 0 ? 1 : _c, teamID = _a.teamID, eventID = _a.eventID, _d = _a.contentFilters, contentFilters = _d === void 0 ? [] : _d; | ||
@@ -124,1 +124,2 @@ return __awaiter(void 0, void 0, void 0, function () { | ||
}; }; | ||
exports.getResults = getResults; |
@@ -53,11 +53,11 @@ "use strict"; | ||
var mappers_1 = require("../utils/mappers"); | ||
exports.getStreams = function (config) { return function (_a) { | ||
var loadLinks = (_a === void 0 ? {} : _a).loadLinks; | ||
var getStreams = function (config) { return function (_a) { | ||
var _b = _a === void 0 ? {} : _a, loadLinks = _b.loadLinks; | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
var $, streams; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: return [4, mappers_1.fetchPage("" + config.hltvUrl, config.loadPage)]; | ||
case 1: | ||
$ = _b.sent(); | ||
$ = _c.sent(); | ||
streams = Promise.all(mappers_1.toArray($('a.col-box.streamer')).map(function (streamEl) { return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -91,3 +91,3 @@ var name, category, country, viewers, hltvLink, stream, $streamPage, realLink; | ||
return [4, streams]; | ||
case 2: return [2, _b.sent()]; | ||
case 2: return [2, _c.sent()]; | ||
} | ||
@@ -97,1 +97,2 @@ }); | ||
}; }; | ||
exports.getStreams = getStreams; |
@@ -42,3 +42,3 @@ "use strict"; | ||
var checkForRateLimiting_1 = require("../utils/checkForRateLimiting"); | ||
exports.getTeam = function (config) { return function (_a) { | ||
var getTeam = function (config) { return function (_a) { | ||
var id = _a.id; | ||
@@ -49,6 +49,6 @@ return __awaiter(void 0, void 0, void 0, function () { | ||
switch (_b.label) { | ||
case 0: return [4, mappers_1.fetchPage(config.hltvUrl + "/team/" + id + "/-", config.loadPage)]; | ||
case 0: return [4, mappers_1.fetchPage(config.hltvUrl + "/team/" + id + "/" + mappers_1.generateRandomSuffix(), config.loadPage)]; | ||
case 1: | ||
t$ = _b.sent(); | ||
return [4, mappers_1.fetchPage(config.hltvUrl + "/stats/teams/events/" + id + "/-", config.loadPage)]; | ||
return [4, mappers_1.fetchPage(config.hltvUrl + "/stats/teams/events/" + id + "/" + mappers_1.generateRandomSuffix(), config.loadPage)]; | ||
case 2: | ||
@@ -131,1 +131,2 @@ e$ = _b.sent(); | ||
}; }; | ||
exports.getTeam = getTeam; |
@@ -42,3 +42,3 @@ "use strict"; | ||
var checkForRateLimiting_1 = require("../utils/checkForRateLimiting"); | ||
exports.getTeamRanking = function (config) { return function (_a) { | ||
var getTeamRanking = function (config) { return function (_a) { | ||
var _b = _a === void 0 ? {} : _a, _c = _b.year, year = _c === void 0 ? '' : _c, _d = _b.month, month = _d === void 0 ? '' : _d, _e = _b.day, day = _e === void 0 ? '' : _e, _f = _b.country, country = _f === void 0 ? '' : _f; | ||
@@ -82,1 +82,2 @@ return __awaiter(void 0, void 0, void 0, function () { | ||
}; }; | ||
exports.getTeamRanking = getTeamRanking; |
import { FullTeamStats } from '../models/FullTeamStats'; | ||
import { HLTVConfig } from '../config'; | ||
export declare const getTeamStats: (config: HLTVConfig) => ({ id, currentRosterOnly }: { | ||
export declare const getTeamStats: (config: HLTVConfig) => ({ id, currentRosterOnly, startDate, endDate }: { | ||
id: number; | ||
currentRosterOnly?: boolean | undefined; | ||
startDate?: string | undefined; | ||
endDate?: string | undefined; | ||
}) => Promise<FullTeamStats>; |
@@ -43,9 +43,10 @@ "use strict"; | ||
var checkForRateLimiting_1 = require("../utils/checkForRateLimiting"); | ||
exports.getTeamStats = function (config) { return function (_a) { | ||
var id = _a.id, currentRosterOnly = _a.currentRosterOnly; | ||
var getTeamStats = function (config) { return function (_a) { | ||
var id = _a.id, currentRosterOnly = _a.currentRosterOnly, startDate = _a.startDate, endDate = _a.endDate; | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
var currentRosterURL, matchesURL, eventsURL, mapsURL, $, getContainerByText, getPlayersByContainer, currentLineup, historicPlayers, standins, m$, e$, mp$, overviewStats, getOverviewStatByIndex, _b, wins, draws, losses, overview, matches, events, getMapStat, mapStats; | ||
var query, currentRosterURL, matchesURL, eventsURL, mapsURL, $, getContainerByText, getPlayersByContainer, currentLineup, historicPlayers, standins, m$, e$, mp$, overviewStats, getOverviewStatByIndex, _b, wins, draws, losses, overview, matches, events, getMapStat, mapStats; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
query = "startDate=" + startDate + "&endDate=" + endDate; | ||
currentRosterURL = ''; | ||
@@ -55,3 +56,3 @@ matchesURL = ''; | ||
mapsURL = ''; | ||
return [4, mappers_1.fetchPage(config.hltvUrl + "/stats/teams/" + id + "/-", config.loadPage)]; | ||
return [4, mappers_1.fetchPage(config.hltvUrl + "/stats/teams/" + id + "/-?" + query, config.loadPage)]; | ||
case 1: | ||
@@ -79,5 +80,5 @@ $ = _c.sent(); | ||
.join('&lineup=') + "&minLineupMatch=0"; | ||
matchesURL = config.hltvUrl + "/stats/lineup/matches?" + currentRosterURL; | ||
eventsURL = config.hltvUrl + "/stats/lineup/events?" + currentRosterURL; | ||
mapsURL = config.hltvUrl + "/stats/lineup/maps?" + currentRosterURL; | ||
matchesURL = config.hltvUrl + "/stats/lineup/matches?" + currentRosterURL + "&" + query; | ||
eventsURL = config.hltvUrl + "/stats/lineup/events?" + currentRosterURL + "&" + query; | ||
mapsURL = config.hltvUrl + "/stats/lineup/maps?" + currentRosterURL + "&" + query; | ||
return [4, mappers_1.fetchPage(config.hltvUrl + "/stats/lineup?" + currentRosterURL, config.loadPage)]; | ||
@@ -88,5 +89,5 @@ case 2: | ||
case 3: | ||
matchesURL = config.hltvUrl + "/stats/teams/matches/" + id + "/-"; | ||
eventsURL = config.hltvUrl + "/stats/teams/events/" + id + "/-"; | ||
mapsURL = config.hltvUrl + "/stats/teams/maps/" + id + "/-"; | ||
matchesURL = config.hltvUrl + "/stats/teams/matches/" + id + "/" + mappers_1.generateRandomSuffix() + "?" + query; | ||
eventsURL = config.hltvUrl + "/stats/teams/events/" + id + "/" + mappers_1.generateRandomSuffix() + "?" + query; | ||
mapsURL = config.hltvUrl + "/stats/teams/maps/" + id + "/" + mappers_1.generateRandomSuffix() + "?" + query; | ||
_c.label = 4; | ||
@@ -170,1 +171,2 @@ case 4: return [4, mappers_1.fetchPage("" + matchesURL, config.loadPage)]; | ||
}; }; | ||
exports.getTeamStats = getTeamStats; |
@@ -59,5 +59,7 @@ import { HLTVConfig } from './config'; | ||
}) => Promise<import("./models/FullTeam").FullTeam>; | ||
getTeamStats: ({ id, currentRosterOnly }: { | ||
getTeamStats: ({ id, currentRosterOnly, startDate, endDate }: { | ||
id: number; | ||
currentRosterOnly?: boolean | undefined; | ||
startDate?: string | undefined; | ||
endDate?: string | undefined; | ||
}) => Promise<import("./models/FullTeamStats").FullTeamStats>; | ||
@@ -85,3 +87,3 @@ getPlayer: ({ id }: { | ||
}) => Promise<import("./models/FullPlayerStats").FullPlayerStats>; | ||
getPlayerRanking: ({ startDate, endDate, matchType, rankingFilter, maps, minMapCount, country, bestOfX }: { | ||
getPlayerRanking: (options?: { | ||
startDate?: string | undefined; | ||
@@ -88,0 +90,0 @@ endDate?: string | undefined; |
@@ -47,2 +47,8 @@ import { WinType } from '../enums/WinType'; | ||
eventId: number; | ||
victimX: number; | ||
victimY: number; | ||
killerX: number; | ||
killerY: number; | ||
killerId: number; | ||
victimId: number; | ||
flasherNick?: string; | ||
@@ -49,0 +55,0 @@ flasherSide?: Side; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.checkForRateLimiting = void 0; | ||
exports.checkForRateLimiting = function ($) { | ||
var checkForRateLimiting = function ($) { | ||
if ($.html().includes('error code: 1015')) { | ||
@@ -9,1 +9,2 @@ throw new Error('Access denied | www.hltv.org used Cloudflare to restrict access'); | ||
}; | ||
exports.checkForRateLimiting = checkForRateLimiting; |
@@ -9,2 +9,3 @@ import * as cheerio from 'cheerio'; | ||
import { Agent as HttpAgent } from 'http'; | ||
export declare const generateRandomSuffix: () => any; | ||
export declare const defaultLoadPage: (httpAgent: HttpsAgent | HttpAgent | undefined) => (url: string) => Promise<string>; | ||
@@ -11,0 +12,0 @@ export declare const fetchPage: (url: string, loadPage?: ((url: string) => Promise<string>) | undefined) => Promise<cheerio.Root>; |
@@ -39,9 +39,14 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getTimestamp = exports.mapRoundElementToModel = exports.getMatchFormatAndMap = exports.getMatchPlayer = exports.mapVetoElementToModel = exports.getMapSlug = exports.toArray = exports.fetchPage = exports.defaultLoadPage = void 0; | ||
exports.getTimestamp = exports.mapRoundElementToModel = exports.getMatchFormatAndMap = exports.getMatchPlayer = exports.mapVetoElementToModel = exports.getMapSlug = exports.toArray = exports.fetchPage = exports.defaultLoadPage = exports.generateRandomSuffix = void 0; | ||
var cheerio = require("cheerio"); | ||
var request = require("request"); | ||
var uuid_1 = require("uuid"); | ||
var RoundOutcome_1 = require("../models/RoundOutcome"); | ||
var MapSlug_1 = require("../enums/MapSlug"); | ||
var parsing_1 = require("../utils/parsing"); | ||
exports.defaultLoadPage = function (httpAgent) { return function (url) { | ||
var generateRandomSuffix = function () { | ||
return uuid_1.v4(); | ||
}; | ||
exports.generateRandomSuffix = generateRandomSuffix; | ||
var defaultLoadPage = function (httpAgent) { return function (url) { | ||
return new Promise(function (resolve) { | ||
@@ -53,3 +58,4 @@ request.get(url, { gzip: true, agent: httpAgent }, function (_, __, body) { | ||
}; }; | ||
exports.fetchPage = function (url, loadPage) { return __awaiter(void 0, void 0, void 0, function () { | ||
exports.defaultLoadPage = defaultLoadPage; | ||
var fetchPage = function (url, loadPage) { return __awaiter(void 0, void 0, void 0, function () { | ||
var _a, _b; | ||
@@ -65,7 +71,10 @@ return __generator(this, function (_c) { | ||
}); }; | ||
exports.toArray = function (elements) { | ||
exports.fetchPage = fetchPage; | ||
var toArray = function (elements) { | ||
return elements.toArray().map(cheerio); | ||
}; | ||
exports.getMapSlug = function (map) { return MapSlug_1.MapSlug[map]; }; | ||
exports.mapVetoElementToModel = function (el, team1, team2) { | ||
exports.toArray = toArray; | ||
var getMapSlug = function (map) { return MapSlug_1.MapSlug[map]; }; | ||
exports.getMapSlug = getMapSlug; | ||
var mapVetoElementToModel = function (el, team1, team2) { | ||
var _a = el | ||
@@ -87,3 +96,4 @@ .text() | ||
}; | ||
exports.getMatchPlayer = function (playerEl) { | ||
exports.mapVetoElementToModel = mapVetoElementToModel; | ||
var getMatchPlayer = function (playerEl) { | ||
return { | ||
@@ -94,3 +104,4 @@ name: playerEl.find('.text-ellipsis').text(), | ||
}; | ||
exports.getMatchFormatAndMap = function (mapText) { | ||
exports.getMatchPlayer = getMatchPlayer; | ||
var getMatchFormatAndMap = function (mapText) { | ||
if (mapText && !mapText.includes('bo')) { | ||
@@ -104,3 +115,4 @@ return { map: mapText, format: 'bo1' }; | ||
}; | ||
exports.mapRoundElementToModel = function (team1Id, team2Id) { return function (el, i, allRoundEls) { | ||
exports.getMatchFormatAndMap = getMatchFormatAndMap; | ||
var mapRoundElementToModel = function (team1Id, team2Id) { return function (el, i, allRoundEls) { | ||
var getOutcome = function (el) { | ||
@@ -160,5 +172,7 @@ var outcomeString = parsing_1.popSlashSource(el).split('.')[0]; | ||
}; }; | ||
exports.getTimestamp = function (source) { | ||
exports.mapRoundElementToModel = mapRoundElementToModel; | ||
var getTimestamp = function (source) { | ||
var _a = source.split('/'), day = _a[0], month = _a[1], year = _a[2]; | ||
return new Date([month, day, year].join('/')).getTime(); | ||
}; | ||
exports.getTimestamp = getTimestamp; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.percentageToDecimalOdd = exports.popSlashSource = exports.hasNoChild = exports.hasChild = exports.prev = exports.text = void 0; | ||
exports.text = function (el) { return el.text(); }; | ||
exports.prev = function (el) { return el.prev(); }; | ||
exports.hasChild = function (childSelector) { return function (el) { | ||
var text = function (el) { return el.text(); }; | ||
exports.text = text; | ||
var prev = function (el) { return el.prev(); }; | ||
exports.prev = prev; | ||
var hasChild = function (childSelector) { return function (el) { | ||
return el.find(childSelector).length !== 0; | ||
}; }; | ||
exports.hasNoChild = function (childSelector) { return function (el) { | ||
exports.hasChild = hasChild; | ||
var hasNoChild = function (childSelector) { return function (el) { | ||
return el.find(childSelector).length === 0; | ||
}; }; | ||
exports.popSlashSource = function (el) { | ||
exports.hasNoChild = hasNoChild; | ||
var popSlashSource = function (el) { | ||
return el.attr('src').split('/').pop(); | ||
}; | ||
exports.percentageToDecimalOdd = function (odd) { | ||
exports.popSlashSource = popSlashSource; | ||
var percentageToDecimalOdd = function (odd) { | ||
return parseFloat(((1 / odd) * 100).toFixed(2)); | ||
}; | ||
exports.percentageToDecimalOdd = percentageToDecimalOdd; |
{ | ||
"name": "hltv", | ||
"version": "2.22.2", | ||
"version": "2.23.0", | ||
"description": "The unofficial HLTV Node.js API", | ||
@@ -48,3 +48,3 @@ "main": "lib/index.js", | ||
"prettier": "^2.0.1", | ||
"ts-jest": "26.4.4", | ||
"ts-jest": "26.5.0", | ||
"ts-node": "^9.0.0", | ||
@@ -56,4 +56,5 @@ "typescript": "4.1.3" | ||
"request": "^2.88.0", | ||
"socket.io-client": "^3.0.0" | ||
"socket.io-client": "2.4.0", | ||
"uuid": "^8.3.2" | ||
} | ||
} |
@@ -115,9 +115,9 @@ [![Dependency Status](https://david-dm.org/gigobyte/hltv.svg)](https://david-dm.org/gigobyte/hltv) | ||
| Option | Type | Default Value | Description | | ||
| :-------: | :-------------------------------------------------------------------------------: | :-----------: | :-----------------: | | ||
| startDate | string? | - | - | | ||
| endDate | string? | - | - | | ||
| matchType | [MatchType](https://github.com/gigobyte/HLTV/blob/master/src/enums/MatchType.ts)? | - | - | | ||
| maps | [Map](https://github.com/gigobyte/HLTV/blob/master/src/enums/Map.ts)[]? | - | - | | ||
| rankingFilter | string? | - | eg. "Top10" | | ||
| Option | Type | Default Value | Description | | ||
| :-------: | :--------------------------------------------------------------------------------------: | :-----------: | :-----------------: | | ||
| startDate | string? | - | - | | ||
| endDate | string? | - | - | | ||
| matchType | [MatchType](https://github.com/gigobyte/HLTV/blob/master/src/enums/MatchType.ts)? | - | - | | ||
| maps | [Map](https://github.com/gigobyte/HLTV/blob/master/src/enums/Map.ts)[]? | - | - | | ||
| rankingFilter | [RankingFilter](https://github.com/gigobyte/HLTV/blob/master/src/enums/RankingFilter.ts)? | - | - | | ||
@@ -278,2 +278,4 @@ ```javascript | ||
| currentRosterOnly | boolean? | false | Return stats about the current roster only | | ||
| startDate | string? | - | - | | ||
| endDate | string? | - | - | | ||
@@ -280,0 +282,0 @@ ```javascript |
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
216469
3920
451
4
+ Addeduuid@^8.3.2
+ Addedafter@0.8.2(transitive)
+ Addedarraybuffer.slice@0.0.7(transitive)
+ Addedblob@0.0.5(transitive)
+ Addedcomponent-bind@1.0.0(transitive)
+ Addedcomponent-inherit@0.0.3(transitive)
+ Addeddebug@3.1.0(transitive)
+ Addedengine.io-client@3.5.4(transitive)
+ Addedengine.io-parser@2.2.1(transitive)
+ Addedhas-binary2@1.0.3(transitive)
+ Addedindexof@0.0.1(transitive)
+ Addedisarray@2.0.1(transitive)
+ Addedms@2.0.0(transitive)
+ Addedpsl@1.15.0(transitive)
+ Addedsocket.io-client@2.4.0(transitive)
+ Addedsocket.io-parser@3.3.4(transitive)
+ Addedto-array@0.1.4(transitive)
+ Addeduuid@8.3.2(transitive)
+ Addedws@7.5.10(transitive)
- Removed@types/component-emitter@1.2.14(transitive)
- Removeddebug@4.3.7(transitive)
- Removedengine.io-client@4.1.4(transitive)
- Removedengine.io-parser@4.0.3(transitive)
- Removedms@2.1.3(transitive)
- Removedpsl@1.14.0(transitive)
- Removedsocket.io-client@3.1.3(transitive)
- Removedsocket.io-parser@4.0.5(transitive)
- Removedws@7.4.6(transitive)
Updatedsocket.io-client@2.4.0