steamutils 1.3.71 → 1.3.72
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +124 -1
- package/package.json +1 -1
package/index.js
CHANGED
@@ -6782,6 +6782,94 @@ export default class SteamUser {
|
|
6782
6782
|
},
|
6783
6783
|
];
|
6784
6784
|
}
|
6785
|
+
async getFriendsGameplayInfo(accessToken, appId) {
|
6786
|
+
if (!appId) {
|
6787
|
+
return;
|
6788
|
+
}
|
6789
|
+
const Protos = helpers([
|
6790
|
+
{
|
6791
|
+
name: "csgo",
|
6792
|
+
protos: loadProfos(`${__dirname}/protos/webui`),
|
6793
|
+
},
|
6794
|
+
]);
|
6795
|
+
const params = {
|
6796
|
+
access_token: accessToken,
|
6797
|
+
origin: "https://store.steampowered.com",
|
6798
|
+
input_protobuf_encoded: protoEncode(Protos.csgo.CPlayer_GetFriendsGameplayInfo_Request, {
|
6799
|
+
appid: appId,
|
6800
|
+
}).toString("base64"),
|
6801
|
+
};
|
6802
|
+
|
6803
|
+
const result = await this._httpRequest({
|
6804
|
+
url: `https://api.steampowered.com/IPlayerService/GetFriendsGameplayInfo/v1?${Object.keys(params)
|
6805
|
+
.map((k) => `${k}=${encodeURIComponent(params[k])}`)
|
6806
|
+
.join("&")}`,
|
6807
|
+
responseType: "arraybuffer",
|
6808
|
+
});
|
6809
|
+
if (result instanceof ResponseError) {
|
6810
|
+
return result;
|
6811
|
+
}
|
6812
|
+
|
6813
|
+
const data = protoDecode(Protos.csgo.CPlayer_GetFriendsGameplayInfo_Response, result.data);
|
6814
|
+
if (!data) return;
|
6815
|
+
const { in_game, played_recently, played_ever, owns, your_info } = data;
|
6816
|
+
const formatList = function (list) {
|
6817
|
+
return list.map(function (item) {
|
6818
|
+
return {
|
6819
|
+
steamId: item.steamid.toString(),
|
6820
|
+
minutes_played: item.minutes_played,
|
6821
|
+
minutes_played_forever: item.minutes_played_forever,
|
6822
|
+
};
|
6823
|
+
});
|
6824
|
+
};
|
6825
|
+
|
6826
|
+
return {
|
6827
|
+
in_game: formatList(in_game),
|
6828
|
+
played_recently: formatList(played_recently),
|
6829
|
+
played_ever: formatList(played_ever),
|
6830
|
+
owns: formatList(owns),
|
6831
|
+
your_info: _.omit(your_info, "steamid"),
|
6832
|
+
};
|
6833
|
+
|
6834
|
+
const example = [
|
6835
|
+
{
|
6836
|
+
public_data: {
|
6837
|
+
visibility_state: 3,
|
6838
|
+
privacy_state: 0,
|
6839
|
+
profile_state: 1,
|
6840
|
+
ban_expires_time: 0,
|
6841
|
+
account_flags: 0,
|
6842
|
+
persona_name: "LOL haha",
|
6843
|
+
profile_url: "",
|
6844
|
+
content_country_restricted: false,
|
6845
|
+
steamId: "76561199243542939",
|
6846
|
+
avatarHash: "0000000000000000000000000000000000000000",
|
6847
|
+
},
|
6848
|
+
private_data: {
|
6849
|
+
persona_state: 0,
|
6850
|
+
persona_state_flags: 0,
|
6851
|
+
time_created: 1644675779,
|
6852
|
+
game_id: 0,
|
6853
|
+
game_server_ip_address: 0,
|
6854
|
+
game_server_port: 0,
|
6855
|
+
game_extra_info: "",
|
6856
|
+
account_name: "",
|
6857
|
+
lobby_steam_id: 0,
|
6858
|
+
rich_presence_kv: "",
|
6859
|
+
watching_broadcast_accountid: 0,
|
6860
|
+
watching_broadcast_appid: 0,
|
6861
|
+
watching_broadcast_viewers: 0,
|
6862
|
+
watching_broadcast_title: "",
|
6863
|
+
last_logoff_time: 0,
|
6864
|
+
last_seen_online: 0,
|
6865
|
+
game_os_type: 0,
|
6866
|
+
game_device_type: 0,
|
6867
|
+
game_device_name: "",
|
6868
|
+
game_is_private: false,
|
6869
|
+
},
|
6870
|
+
},
|
6871
|
+
];
|
6872
|
+
}
|
6785
6873
|
async getPurchaseHistory() {
|
6786
6874
|
const result = await this._httpRequest({
|
6787
6875
|
url: `https://store.steampowered.com/account/history/`,
|
@@ -6795,7 +6883,42 @@ export default class SteamUser {
|
|
6795
6883
|
}
|
6796
6884
|
|
6797
6885
|
const $ = cheerio.load(result?.data);
|
6798
|
-
|
6886
|
+
const table = $(".wallet_history_table");
|
6887
|
+
return [...table.find("tr")]
|
6888
|
+
.map(function (el) {
|
6889
|
+
el = $(el);
|
6890
|
+
|
6891
|
+
if (el.children().length !== 6) return;
|
6892
|
+
const typeEL = el.find(".wht_type");
|
6893
|
+
const typePayment = StringUtils.cleanSpace(typeEL.find(".wth_payment").text());
|
6894
|
+
typeEL.find(".wth_payment").remove();
|
6895
|
+
const type = StringUtils.cleanSpace(typeEL.text());
|
6896
|
+
|
6897
|
+
const totalEL = el.find(".wht_total");
|
6898
|
+
const totalPayment = StringUtils.cleanSpace(totalEL.find(".wth_payment").text());
|
6899
|
+
totalEL.find(".wth_payment").remove();
|
6900
|
+
const total = StringUtils.cleanSpace(totalEL.text());
|
6901
|
+
|
6902
|
+
const wallet_change = StringUtils.cleanSpace(el.find(".wht_wallet_change").text());
|
6903
|
+
const wallet_balance = StringUtils.cleanSpace(el.find(".wht_wallet_balance").text());
|
6904
|
+
|
6905
|
+
return {
|
6906
|
+
date: StringUtils.cleanSpace(el.find(".wht_date").text()),
|
6907
|
+
items: StringUtils.cleanSpace(el.find(".wht_items").text()),
|
6908
|
+
type: {
|
6909
|
+
type,
|
6910
|
+
payment: typePayment,
|
6911
|
+
},
|
6912
|
+
total: {
|
6913
|
+
total,
|
6914
|
+
payment: totalPayment,
|
6915
|
+
},
|
6916
|
+
wallet_change,
|
6917
|
+
wallet_balance,
|
6918
|
+
};
|
6919
|
+
})
|
6920
|
+
.filter(Boolean);
|
6921
|
+
|
6799
6922
|
/*
|
6800
6923
|
const result = await this._httpRequestAjax({
|
6801
6924
|
url: `https://store.steampowered.com/account/AjaxLoadMoreHistory/`,
|