steamutils 1.3.71 → 1.3.73
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +171 -1
- package/package.json +1 -1
package/index.js
CHANGED
@@ -6048,6 +6048,53 @@ export default class SteamUser {
|
|
6048
6048
|
}
|
6049
6049
|
}
|
6050
6050
|
|
6051
|
+
async getMyMarketHistory({ start = 0, count = 10 } = {}) {
|
6052
|
+
const result = await this._httpRequestAjax({
|
6053
|
+
url: `market/myhistory/render/?query=&start=${start}&count=${count}`,
|
6054
|
+
});
|
6055
|
+
if (result instanceof ResponseError) {
|
6056
|
+
return result;
|
6057
|
+
}
|
6058
|
+
const data = result?.data;
|
6059
|
+
if (data?.success === true) {
|
6060
|
+
const $ = cheerio.load(data.results_html);
|
6061
|
+
const list = [];
|
6062
|
+
$(".market_listing_row").each(function () {
|
6063
|
+
const $1 = $(this);
|
6064
|
+
const id = $1.attr("id");
|
6065
|
+
const listingid = id.substringBetweenOrNull("history_row_", "_");
|
6066
|
+
if (!listingid) {
|
6067
|
+
return;
|
6068
|
+
}
|
6069
|
+
const gainOrLoss = StringUtils.cleanSpace($1.find(".market_listing_gainorloss").text());
|
6070
|
+
const image = $1.find(`.market_listing_item_img`).attr("src");
|
6071
|
+
const price = parseInt($1.find(`.market_table_value .market_listing_price`).text().replaceAll(`(`, "").replaceAll(`)`, "").replaceAll(`₫`, "").replaceAll(`.`, "").replaceAll(`,`, "").trim()) || "";
|
6072
|
+
const item_name = $1.find(".market_listing_item_name").text();
|
6073
|
+
const game_name = $1.find(".market_listing_game_name").text();
|
6074
|
+
|
6075
|
+
const listedOn = StringUtils.cleanSpace($1.find(".market_listing_listed_date + .market_listing_listed_date").text().replaceAll(`Listed:`, ""));
|
6076
|
+
const actedOn = StringUtils.cleanSpace($1.find(".market_listing_whoactedwith + .market_listing_listed_date").text().replaceAll(`Listed:`, ""));
|
6077
|
+
|
6078
|
+
const status = StringUtils.cleanSpace($1.find(".market_listing_whoactedwith").text());
|
6079
|
+
|
6080
|
+
list.push({
|
6081
|
+
id,
|
6082
|
+
listingid,
|
6083
|
+
price,
|
6084
|
+
item_name,
|
6085
|
+
game_name,
|
6086
|
+
listedOn,
|
6087
|
+
actedOn,
|
6088
|
+
image,
|
6089
|
+
gainOrLoss,
|
6090
|
+
status,
|
6091
|
+
});
|
6092
|
+
});
|
6093
|
+
const assets = Object.values(data.assets["730"]?.["2"] || {});
|
6094
|
+
return { ...data, list, assets, success: true };
|
6095
|
+
}
|
6096
|
+
}
|
6097
|
+
|
6051
6098
|
async getPlayerReports(token) {
|
6052
6099
|
const param = {
|
6053
6100
|
sessionid: this._sessionId,
|
@@ -6782,6 +6829,94 @@ export default class SteamUser {
|
|
6782
6829
|
},
|
6783
6830
|
];
|
6784
6831
|
}
|
6832
|
+
async getFriendsGameplayInfo(accessToken, appId) {
|
6833
|
+
if (!appId) {
|
6834
|
+
return;
|
6835
|
+
}
|
6836
|
+
const Protos = helpers([
|
6837
|
+
{
|
6838
|
+
name: "csgo",
|
6839
|
+
protos: loadProfos(`${__dirname}/protos/webui`),
|
6840
|
+
},
|
6841
|
+
]);
|
6842
|
+
const params = {
|
6843
|
+
access_token: accessToken,
|
6844
|
+
origin: "https://store.steampowered.com",
|
6845
|
+
input_protobuf_encoded: protoEncode(Protos.csgo.CPlayer_GetFriendsGameplayInfo_Request, {
|
6846
|
+
appid: appId,
|
6847
|
+
}).toString("base64"),
|
6848
|
+
};
|
6849
|
+
|
6850
|
+
const result = await this._httpRequest({
|
6851
|
+
url: `https://api.steampowered.com/IPlayerService/GetFriendsGameplayInfo/v1?${Object.keys(params)
|
6852
|
+
.map((k) => `${k}=${encodeURIComponent(params[k])}`)
|
6853
|
+
.join("&")}`,
|
6854
|
+
responseType: "arraybuffer",
|
6855
|
+
});
|
6856
|
+
if (result instanceof ResponseError) {
|
6857
|
+
return result;
|
6858
|
+
}
|
6859
|
+
|
6860
|
+
const data = protoDecode(Protos.csgo.CPlayer_GetFriendsGameplayInfo_Response, result.data);
|
6861
|
+
if (!data) return;
|
6862
|
+
const { in_game, played_recently, played_ever, owns, your_info } = data;
|
6863
|
+
const formatList = function (list) {
|
6864
|
+
return list.map(function (item) {
|
6865
|
+
return {
|
6866
|
+
steamId: item.steamid.toString(),
|
6867
|
+
minutes_played: item.minutes_played,
|
6868
|
+
minutes_played_forever: item.minutes_played_forever,
|
6869
|
+
};
|
6870
|
+
});
|
6871
|
+
};
|
6872
|
+
|
6873
|
+
return {
|
6874
|
+
in_game: formatList(in_game),
|
6875
|
+
played_recently: formatList(played_recently),
|
6876
|
+
played_ever: formatList(played_ever),
|
6877
|
+
owns: formatList(owns),
|
6878
|
+
your_info: _.omit(your_info, "steamid"),
|
6879
|
+
};
|
6880
|
+
|
6881
|
+
const example = [
|
6882
|
+
{
|
6883
|
+
public_data: {
|
6884
|
+
visibility_state: 3,
|
6885
|
+
privacy_state: 0,
|
6886
|
+
profile_state: 1,
|
6887
|
+
ban_expires_time: 0,
|
6888
|
+
account_flags: 0,
|
6889
|
+
persona_name: "LOL haha",
|
6890
|
+
profile_url: "",
|
6891
|
+
content_country_restricted: false,
|
6892
|
+
steamId: "76561199243542939",
|
6893
|
+
avatarHash: "0000000000000000000000000000000000000000",
|
6894
|
+
},
|
6895
|
+
private_data: {
|
6896
|
+
persona_state: 0,
|
6897
|
+
persona_state_flags: 0,
|
6898
|
+
time_created: 1644675779,
|
6899
|
+
game_id: 0,
|
6900
|
+
game_server_ip_address: 0,
|
6901
|
+
game_server_port: 0,
|
6902
|
+
game_extra_info: "",
|
6903
|
+
account_name: "",
|
6904
|
+
lobby_steam_id: 0,
|
6905
|
+
rich_presence_kv: "",
|
6906
|
+
watching_broadcast_accountid: 0,
|
6907
|
+
watching_broadcast_appid: 0,
|
6908
|
+
watching_broadcast_viewers: 0,
|
6909
|
+
watching_broadcast_title: "",
|
6910
|
+
last_logoff_time: 0,
|
6911
|
+
last_seen_online: 0,
|
6912
|
+
game_os_type: 0,
|
6913
|
+
game_device_type: 0,
|
6914
|
+
game_device_name: "",
|
6915
|
+
game_is_private: false,
|
6916
|
+
},
|
6917
|
+
},
|
6918
|
+
];
|
6919
|
+
}
|
6785
6920
|
async getPurchaseHistory() {
|
6786
6921
|
const result = await this._httpRequest({
|
6787
6922
|
url: `https://store.steampowered.com/account/history/`,
|
@@ -6795,7 +6930,42 @@ export default class SteamUser {
|
|
6795
6930
|
}
|
6796
6931
|
|
6797
6932
|
const $ = cheerio.load(result?.data);
|
6798
|
-
|
6933
|
+
const table = $(".wallet_history_table");
|
6934
|
+
return [...table.find("tr")]
|
6935
|
+
.map(function (el) {
|
6936
|
+
el = $(el);
|
6937
|
+
|
6938
|
+
if (el.children().length !== 6) return;
|
6939
|
+
const typeEL = el.find(".wht_type");
|
6940
|
+
const typePayment = StringUtils.cleanSpace(typeEL.find(".wth_payment").text());
|
6941
|
+
typeEL.find(".wth_payment").remove();
|
6942
|
+
const type = StringUtils.cleanSpace(typeEL.text());
|
6943
|
+
|
6944
|
+
const totalEL = el.find(".wht_total");
|
6945
|
+
const totalPayment = StringUtils.cleanSpace(totalEL.find(".wth_payment").text());
|
6946
|
+
totalEL.find(".wth_payment").remove();
|
6947
|
+
const total = StringUtils.cleanSpace(totalEL.text());
|
6948
|
+
|
6949
|
+
const wallet_change = StringUtils.cleanSpace(el.find(".wht_wallet_change").text());
|
6950
|
+
const wallet_balance = StringUtils.cleanSpace(el.find(".wht_wallet_balance").text());
|
6951
|
+
|
6952
|
+
return {
|
6953
|
+
date: StringUtils.cleanSpace(el.find(".wht_date").text()),
|
6954
|
+
items: StringUtils.cleanSpace(el.find(".wht_items").text()),
|
6955
|
+
type: {
|
6956
|
+
type,
|
6957
|
+
payment: typePayment,
|
6958
|
+
},
|
6959
|
+
total: {
|
6960
|
+
total,
|
6961
|
+
payment: totalPayment,
|
6962
|
+
},
|
6963
|
+
wallet_change,
|
6964
|
+
wallet_balance,
|
6965
|
+
};
|
6966
|
+
})
|
6967
|
+
.filter(Boolean);
|
6968
|
+
|
6799
6969
|
/*
|
6800
6970
|
const result = await this._httpRequestAjax({
|
6801
6971
|
url: `https://store.steampowered.com/account/AjaxLoadMoreHistory/`,
|