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 3.2.0 to 3.2.1

10

lib/config.js

@@ -34,3 +34,11 @@ "use strict";

agent: httpAgent,
headers: { 'User-Agent': random_useragent_1.default.getRandom() }
headers: {
'User-Agent': random_useragent_1.default.getRandom(function (ue) {
return [
'/Browsers - Windows',
'/Browsers - Linux',
'/Browsers - Mac'
].includes(ue.folder);
})
}
}, function (err, __, body) {

@@ -37,0 +45,0 @@ if (err) {

2

lib/endpoints/getEventByName.js

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

_c = (_b = JSON).parse;
return [4 /*yield*/, config.loadPage("https://www.hltv.org/events/search?term=" + name)];
return [4 /*yield*/, config.loadPage("https://www.hltv.org/search?term=" + name)];
case 1:

@@ -52,0 +52,0 @@ pageContent = _c.apply(_b, [_d.sent()]);

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

location?: Country;
featured: boolean;
}

@@ -14,0 +15,0 @@ export interface GetEventsArguments {

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

return __awaiter(void 0, void 0, void 0, function () {
var query, $, _a, ongoingEvents, bigUpcomingEvents, smallUpcomingEvents;
var query, $, _a, featuredOngoingEvents, ongoingEvents, bigUpcomingEvents, smallUpcomingEvents;
return __generator(this, function (_b) {

@@ -69,2 +69,5 @@ switch (_b.label) {

$ = _a.apply(void 0, [_b.sent()]);
featuredOngoingEvents = $('.tab-content[id="FEATURED"] a.ongoing-event')
.toArray()
.map(function (el) { return el.attrThen('href', utils_1.getIdAt(2)); });
ongoingEvents = $('.tab-content[id="ALL"] a.ongoing-event')

@@ -83,3 +86,4 @@ .toArray()

.numFromAttr('data-unix');
return { id: id, name: name, dateStart: dateStart, dateEnd: dateEnd };
var featured = featuredOngoingEvents.includes(id);
return { id: id, name: name, dateStart: dateStart, dateEnd: dateEnd, featured: featured };
});

@@ -99,11 +103,14 @@ bigUpcomingEvents = $('a.big-event')

.numFromAttr('data-unix');
var location = {
name: el.find('.big-event-location').text(),
code: el
.find('.location-top-teams img.flag')
.attr('src')
.split('/')
.pop()
.split('.')[0]
};
var locationName = el.find('.big-event-location').text();
var location = locationName !== 'TBA'
? {
name: locationName,
code: el
.find('.location-top-teams img.flag')
.attr('src')
.split('/')
.pop()
.split('.')[0]
}
: undefined;
var prizePool = el

@@ -123,3 +130,4 @@ .find('.additional-info tr')

prizePool: prizePool,
numberOfTeams: numberOfTeams
numberOfTeams: numberOfTeams,
featured: true
};

@@ -164,3 +172,4 @@ });

prizePool: prizePool,
numberOfTeams: numberOfTeams
numberOfTeams: numberOfTeams,
featured: false
};

@@ -167,0 +176,0 @@ });

@@ -132,3 +132,5 @@ "use strict";

name: $(".team" + n + "-gradient .teamName").text(),
id: $(".team" + n + "-gradient a").attrThen('href', utils_1.getIdAt(2))
id: $(".team" + n + "-gradient a").attrThen('href', function (href) {
return href ? utils_1.getIdAt(2, href) : undefined;
})
}

@@ -230,4 +232,4 @@ : undefined;

var halfs = halfsString
.substring(1, halfsString.length - 1)
.split('; ')
.split(' ')
.map(function (x) { return x.replace(/\(|\)|;/g, ''); })
.map(function (half) { return ({

@@ -266,3 +268,3 @@ team1Rounds: Number(half.split(':')[0]),

team2: $('div.players')
.last()
.eq(1)
.find('tr')

@@ -278,7 +280,7 @@ .last()

.toArray()
.filter(function (el) { return el.find('.flagAlign').exists(); })
.filter(function (el) { return el.find('.stream-flag').exists(); })
.map(function (streamEl) { return ({
name: streamEl.find('.flagAlign').text(),
name: streamEl.text(),
link: streamEl.attr('data-stream-embed'),
viewers: streamEl.find('.viewers').numFromText()
viewers: streamEl.find('.viewers.gtSmartphone-only').numFromText()
}); })

@@ -285,0 +287,0 @@ .concat($('.stream-box.hltv-live').exists()

import { HLTVConfig } from '../config';
import { Country } from '../shared/Country';
import { EventType } from '../shared/EventType';
import { EventPreview } from './getEvents';
export interface PastEventPreview {
id: number;
type: EventType;
name: string;
dateStart: number;
dateEnd: number;
numberOfTeams: number;
prizePool: string;
location: Country;
}
export interface GetPastEventsArguments {

@@ -14,2 +24,2 @@ startDate?: string;

}
export declare const getPastEvents: (config: HLTVConfig) => (options: GetPastEventsArguments) => Promise<EventPreview[]>;
export declare const getPastEvents: (config: HLTVConfig) => (options: GetPastEventsArguments) => Promise<PastEventPreview[]>;

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

var scraper_1 = require("../scraper");
var EventType_1 = require("../shared/EventType");
var utils_1 = require("../utils");

@@ -86,2 +87,3 @@ var getPastEvents = function (config) { return function (options) { return __awaiter(void 0, void 0, void 0, function () {

.text();
var type = EventType_1.fromText(el.find('.table tr').first().find('td').last().text());
var dateStart = el

@@ -105,6 +107,7 @@ .find('td span[data-unix]')

var prizePool = el.find('.prizePoolEllipsis').text();
var numberOfTeams = utils_1.parseNumber(el.find('.prizePoolEllipsis').prev().text().replace('+', ''));
var numberOfTeams = Number(el.find('.prizePoolEllipsis').prev().text().replace('+', ''));
return {
id: id,
name: name,
type: type,
dateStart: dateStart,

@@ -111,0 +114,0 @@ dateEnd: dateEnd,

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

page++;
results.push.apply(results, $('.result-con')
results.push.apply(results, $('.allres .result-con')
.toArray()

@@ -93,0 +93,0 @@ .map(function (el) {

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

getEvents: (options?: import("./endpoints/getEvents").GetEventsArguments) => Promise<import("./endpoints/getEvents").EventPreview[]>;
getPastEvents: (options: import("./endpoints/getPastEvents").GetPastEventsArguments) => Promise<import("./endpoints/getEvents").EventPreview[]>;
getPastEvents: (options: import("./endpoints/getPastEvents").GetPastEventsArguments) => Promise<import("./endpoints/getPastEvents").PastEventPreview[]>;
getEventByName: ({ name }: {

@@ -16,0 +16,0 @@ name: string;

@@ -9,1 +9,2 @@ export declare enum EventType {

}
export declare const fromText: (str: string) => EventType | undefined;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventType = void 0;
exports.fromText = exports.EventType = void 0;
var EventType;

@@ -13,1 +13,18 @@ (function (EventType) {

})(EventType = exports.EventType || (exports.EventType = {}));
var fromText = function (str) {
switch (str) {
case 'Online':
return EventType.Online;
case 'Intl. LAN':
return EventType.InternationalLAN;
case 'Local LAN':
return EventType.LocalLAN;
case 'Reg. LAN':
return EventType.RegionalLAN;
case 'Major':
return EventType.Major;
case 'Other':
return EventType.Other;
}
};
exports.fromText = fromText;
{
"name": "hltv",
"version": "3.2.0",
"version": "3.2.1",
"description": "The unofficial HLTV Node.js API",

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

"ts-node": "9.1.1",
"typescript": "4.2.3"
"typescript": "4.2.4"
},

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

@@ -89,3 +89,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/getMatch.ts#L71)**
**[See schema](https://github.com/gigobyte/HLTV/blob/master/src/endpoints/getMatch.ts#L79)**

@@ -455,3 +455,3 @@ ---

**[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/getPastEvents.ts#L8)**

@@ -458,0 +458,0 @@ ---

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