steamutils 1.3.55 → 1.3.56
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +26 -2
- package/package.json +1 -1
package/index.js
CHANGED
@@ -4938,10 +4938,10 @@ export default class SteamUser {
|
|
4938
4938
|
if (result instanceof ResponseError) {
|
4939
4939
|
return result;
|
4940
4940
|
}
|
4941
|
-
if (!result.data) {
|
4941
|
+
if (!result.data || typeof result.data !== "string") {
|
4942
4942
|
return;
|
4943
4943
|
}
|
4944
|
-
const $ = result.
|
4944
|
+
const $ = cheerio.load(result.data);
|
4945
4945
|
let email = "";
|
4946
4946
|
$(".account_setting_block").each(function () {
|
4947
4947
|
if (email) return;
|
@@ -6327,6 +6327,30 @@ export default class SteamUser {
|
|
6327
6327
|
|
6328
6328
|
return { steamId, wallet, country, email, accountSecurity, accountName };
|
6329
6329
|
}
|
6330
|
+
|
6331
|
+
async getFriendSince(steamId) {
|
6332
|
+
const accountId = SteamUser.steamID642Miniprofile(steamId);
|
6333
|
+
const result = await this._httpRequest("tradeoffer/new/?partner=" + accountId);
|
6334
|
+
if (result instanceof ResponseError) {
|
6335
|
+
return result;
|
6336
|
+
}
|
6337
|
+
const html = result?.data;
|
6338
|
+
if (!html || typeof html !== "string") {
|
6339
|
+
return;
|
6340
|
+
}
|
6341
|
+
const $ = cheerio.load(html);
|
6342
|
+
const container = $(".trade_partner_header.responsive_trade_offersection");
|
6343
|
+
const friendSince = [...container.find(".trade_partner_info_block")]
|
6344
|
+
.map(function (el) {
|
6345
|
+
el = $(el);
|
6346
|
+
if (el.text().includes("You've been friends since")) {
|
6347
|
+
return StringUtils.cleanSpace(el.find(".trade_partner_info_text").text());
|
6348
|
+
}
|
6349
|
+
})
|
6350
|
+
.filter(Boolean);
|
6351
|
+
//example 13 June, 2023
|
6352
|
+
return friendSince[0];
|
6353
|
+
}
|
6330
6354
|
}
|
6331
6355
|
|
6332
6356
|
SteamUser.MAX_RETRY = 10;
|