steamutils 1.3.69 → 1.3.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/SteamClient.js +1 -2
  2. package/index.js +192 -5
  3. package/package.json +1 -1
  4. package/protos/webui/common.proto +4024 -0
  5. package/protos/webui/common_base.proto +27 -0
  6. package/protos/webui/service_accountcart.proto +153 -0
  7. package/protos/webui/service_accountlinking.proto +27 -0
  8. package/protos/webui/service_accountprivacy.proto +42 -0
  9. package/protos/webui/service_accountprivateapps.proto +34 -0
  10. package/protos/webui/service_auction.proto +97 -0
  11. package/protos/webui/service_authentication.proto +222 -0
  12. package/protos/webui/service_authenticationsupport.proto +74 -0
  13. package/protos/webui/service_broadcast.proto +562 -0
  14. package/protos/webui/service_chat.proto +11 -0
  15. package/protos/webui/service_chatroom.proto +810 -0
  16. package/protos/webui/service_chatusability.proto +107 -0
  17. package/protos/webui/service_checkout.proto +84 -0
  18. package/protos/webui/service_clan.proto +41 -0
  19. package/protos/webui/service_clanchatrooms.proto +25 -0
  20. package/protos/webui/service_clanfaqs.proto +202 -0
  21. package/protos/webui/service_clientcomm.proto +151 -0
  22. package/protos/webui/service_clientmetrics.proto +22 -0
  23. package/protos/webui/service_cloud.proto +222 -0
  24. package/protos/webui/service_cloudconfigstore.proto +51 -0
  25. package/protos/webui/service_cloudgaming.proto +30 -0
  26. package/protos/webui/service_community.proto +365 -0
  27. package/protos/webui/service_dailydeal.proto +89 -0
  28. package/protos/webui/service_econ.proto +134 -0
  29. package/protos/webui/service_embedded.proto +24 -0
  30. package/protos/webui/service_experimentservice.proto +6 -0
  31. package/protos/webui/service_familygroups.proto +355 -0
  32. package/protos/webui/service_fovasvideo.proto +15 -0
  33. package/protos/webui/service_friendmessages.proto +133 -0
  34. package/protos/webui/service_friendslist.proto +70 -0
  35. package/protos/webui/service_gamenotes.proto +15 -0
  36. package/protos/webui/service_gamerecording.proto +265 -0
  37. package/protos/webui/service_gamerecordingclip.proto +85 -0
  38. package/protos/webui/service_gamerecordingdebug.proto +52 -0
  39. package/protos/webui/service_helprequestlogs.proto +16 -0
  40. package/protos/webui/service_loyaltyrewards.proto +252 -0
  41. package/protos/webui/service_marketingmessages.proto +215 -0
  42. package/protos/webui/service_mobileapp.proto +18 -0
  43. package/protos/webui/service_mobileauth.proto +24 -0
  44. package/protos/webui/service_mobiledevice.proto +26 -0
  45. package/protos/webui/service_mobileperaccount.proto +31 -0
  46. package/protos/webui/service_news.proto +110 -0
  47. package/protos/webui/service_parental.proto +258 -0
  48. package/protos/webui/service_partnermembershipinvite.proto +34 -0
  49. package/protos/webui/service_partnerstorebrowse.proto +28 -0
  50. package/protos/webui/service_phone.proto +51 -0
  51. package/protos/webui/service_physicalgoods.proto +15 -0
  52. package/protos/webui/service_player.proto +918 -0
  53. package/protos/webui/service_promotioneventinvites.proto +109 -0
  54. package/protos/webui/service_promotionplanning.proto +186 -0
  55. package/protos/webui/service_promotionstats.proto +23 -0
  56. package/protos/webui/service_publishedfile.proto +714 -0
  57. package/protos/webui/service_publishing.proto +200 -0
  58. package/protos/webui/service_quest.proto +127 -0
  59. package/protos/webui/service_salefeature.proto +373 -0
  60. package/protos/webui/service_saleitemrewards.proto +54 -0
  61. package/protos/webui/service_shoppingcart.proto +152 -0
  62. package/protos/webui/service_steamawards.proto +76 -0
  63. package/protos/webui/service_steamcharts.proto +75 -0
  64. package/protos/webui/service_steamengine.proto +36 -0
  65. package/protos/webui/service_steamlearn.proto +876 -0
  66. package/protos/webui/service_steamnotification.proto +73 -0
  67. package/protos/webui/service_steamtv.proto +495 -0
  68. package/protos/webui/service_steamvrvoicechat.proto +67 -0
  69. package/protos/webui/service_steamvrwebrtc.proto +48 -0
  70. package/protos/webui/service_storagedevicemanager.proto +104 -0
  71. package/protos/webui/service_store.proto +359 -0
  72. package/protos/webui/service_storeappsimilarity.proto +76 -0
  73. package/protos/webui/service_storebrowse.proto +103 -0
  74. package/protos/webui/service_storemarketing.proto +44 -0
  75. package/protos/webui/service_storequery.proto +103 -0
  76. package/protos/webui/service_storesales.proto +87 -0
  77. package/protos/webui/service_storetopsellers.proto +44 -0
  78. package/protos/webui/service_systemmanager.proto +11 -0
  79. package/protos/webui/service_test_transporterror.proto +6 -0
  80. package/protos/webui/service_transportauth.proto +17 -0
  81. package/protos/webui/service_transportvalidation.proto +69 -0
  82. package/protos/webui/service_twofactor.proto +170 -0
  83. package/protos/webui/service_useraccount.proto +142 -0
  84. package/protos/webui/service_usergameactivity.proto +34 -0
  85. package/protos/webui/service_usergamenotes.proto +70 -0
  86. package/protos/webui/service_usernews.proto +68 -0
  87. package/protos/webui/service_userreviews.proto +97 -0
  88. package/protos/webui/service_video.proto +50 -0
  89. package/protos/webui/service_videoclip.proto +62 -0
  90. package/protos/webui/service_voicechat.proto +139 -0
  91. package/protos/webui/service_webrtc.proto +52 -0
package/SteamClient.js CHANGED
@@ -15,8 +15,7 @@ import SteamCommunity from "steamcommunity";
15
15
  import moment from "moment-timezone";
16
16
  import { encode, encodeUids } from "./bufferHelpers.js";
17
17
 
18
- const __filename = fileURLToPath(import.meta.url);
19
- const __dirname = path.dirname(__filename);
18
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
20
19
 
21
20
  const Protos = helpers([
22
21
  {
package/index.js CHANGED
@@ -4,12 +4,12 @@ import _ from "lodash";
4
4
  import moment from "moment";
5
5
  import { hex2b64, Key as RSA } from "node-bignumber";
6
6
  import SteamID from "steamid";
7
- import URL from "url";
7
+ import URL, { fileURLToPath } from "url";
8
8
  import Url from "url-parse";
9
9
  import xml2js from "xml2js";
10
10
  import { console_log, getCleanObject, JSON_parse, JSON_stringify, removeSpaceKeys, sleep } from "./utils.js";
11
11
  import { Header, request } from "./axios.js";
12
- import { getDocumentTitle, getTableHasHeaders, querySelectorAll, table2json } from "./cheerio.js";
12
+ import { getTableHasHeaders, querySelectorAll, table2json } from "./cheerio.js";
13
13
  import { getJSObjectFronXML } from "./xml2json.js";
14
14
  import axios from "axios";
15
15
  import * as cheerio from "cheerio";
@@ -23,6 +23,9 @@ import CookieManager from "./CookieManager.js";
23
23
  import { AppID_CSGO, E1GameBanOnRecord, E1VACBanOnRecord, EActivityType, ECommentPrivacyState, ECurrentlyTradeBanned, EdaySinceLastBanRegExp, EFriendRelationship, ELanguage, EmptyProfileSummary, EMultipleGameBansOnRecord, EMultipleVACBansOnRecord, EPrivacyState, ErrorProcessingRequest, FRIEND_CODE_REPLACEMENTS, NotYetSetupProfileTextList, PrivacySettings, PrivateProfileTextList, SteamcommunityURL, SteamErrorTitle, SteamImageCDN } from "./const.js";
24
24
  import SteamCommunity from "steamcommunity";
25
25
  import SteamTotp from "steam-totp";
26
+ import { protoDecode, protoEncode } from "./helpers/util.js";
27
+ import helpers, { loadProfos } from "./helpers/protos.js";
28
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
26
29
 
27
30
  let requestTimestamp = 0;
28
31
  let tooManyRequestTimestamp = 0;
@@ -6595,11 +6598,12 @@ export default class SteamUser {
6595
6598
  el = $(el);
6596
6599
  const status = el.find(".help_request_columns .status").text();
6597
6600
  const link = el.attr("href");
6601
+ const id = link.removeSuffix("/").substringAfterLast("/");
6598
6602
  const title = el.find(".help_request_name").text().trim();
6599
6603
  const date_created = el.find(".help_request_columns .date_created").text().trim();
6600
6604
  return {
6601
6605
  status,
6602
- link,
6606
+ id,
6603
6607
  title,
6604
6608
  date_created,
6605
6609
  };
@@ -6608,9 +6612,9 @@ export default class SteamUser {
6608
6612
  return help_request_row;
6609
6613
  }
6610
6614
 
6611
- async getHelpRequestDetail(url) {
6615
+ async getHelpRequestDetail(id) {
6612
6616
  const result = await this._httpRequest({
6613
- url,
6617
+ url: `https://help.steampowered.com/en/wizard/HelpRequest/${id}`,
6614
6618
  });
6615
6619
  if (result instanceof ResponseError) {
6616
6620
  return result;
@@ -6619,6 +6623,189 @@ export default class SteamUser {
6619
6623
  const help_request_page = $(".help_request_page");
6620
6624
  return help_request_page.html();
6621
6625
  }
6626
+ async getFriendOwnershipForGifting(accessToken) {
6627
+ //730, csggo
6628
+ const result = await this._httpRequest({
6629
+ url: `https://api.steampowered.com/ICheckoutService/GetFriendOwnershipForGifting/v1?access_token=${accessToken}&spoof_steamid=&origin=https:%2F%2Fstore.steampowered.com&input_protobuf_encoded=CgQQjaYD`,
6630
+ responseType: "arraybuffer",
6631
+ });
6632
+ if (result instanceof ResponseError) {
6633
+ return result;
6634
+ }
6635
+ const Protos = helpers([
6636
+ {
6637
+ name: "csgo",
6638
+ protos: loadProfos(`${__dirname}/protos/webui`),
6639
+ },
6640
+ ]);
6641
+
6642
+ return protoDecode(Protos.csgo.CCheckout_GetFriendOwnershipForGifting_Response, result.data)?.ownership_info;
6643
+ const example = [
6644
+ {
6645
+ friend_ownership: [
6646
+ {
6647
+ partial_owns_appids: [730, 2279720, 2279721],
6648
+ partial_wishes_for: [],
6649
+ accountid: 1610715881,
6650
+ already_owns: false,
6651
+ wishes_for: false,
6652
+ },
6653
+ ],
6654
+ item_id: {
6655
+ appid: 0,
6656
+ packageid: 54029,
6657
+ bundleid: 0,
6658
+ tagid: 0,
6659
+ creatorid: 0,
6660
+ hubcategoryid: 0,
6661
+ },
6662
+ },
6663
+ ];
6664
+ }
6665
+ async getFriendsList_v1(accessToken) {
6666
+ //730, csggo
6667
+ const result = await this._httpRequest({
6668
+ url: `https://api.steampowered.com/IFriendsListService/GetFriendsList/v1?access_token=${accessToken}&spoof_steamid=&origin=https:%2F%2Fstore.steampowered.com&input_protobuf_encoded=`,
6669
+ responseType: "arraybuffer",
6670
+ });
6671
+ if (result instanceof ResponseError) {
6672
+ return result;
6673
+ }
6674
+ const Protos = helpers([
6675
+ {
6676
+ name: "csgo",
6677
+ protos: loadProfos(`${__dirname}/protos/webui`),
6678
+ },
6679
+ ]);
6680
+
6681
+ return protoDecode(Protos.csgo.CFriendsList_GetFriendsList_Response, result.data)?.friendslist?.friends?.map(function (friend) {
6682
+ return {
6683
+ efriendrelationship: friend.efriendrelationship,
6684
+ steamId: friend.ulfriendid.toString(),
6685
+ };
6686
+ });
6687
+ const example = [
6688
+ {
6689
+ efriendrelationship: 4,
6690
+ steamId: "76561198094495120",
6691
+ },
6692
+ {
6693
+ efriendrelationship: 3,
6694
+ steamId: "103582791472436098",
6695
+ },
6696
+ ];
6697
+ }
6698
+ async getPlayerLinkDetails(accessToken, steamIds) {
6699
+ if (!steamIds) {
6700
+ return;
6701
+ }
6702
+ if (!Array.isArray(steamIds)) {
6703
+ steamIds = [steamIds];
6704
+ }
6705
+ const Protos = helpers([
6706
+ {
6707
+ name: "csgo",
6708
+ protos: loadProfos(`${__dirname}/protos/webui`),
6709
+ },
6710
+ ]);
6711
+ const params = {
6712
+ access_token: accessToken,
6713
+ spoof_steamid: "",
6714
+ origin: "https://store.steampowered.com",
6715
+ input_protobuf_encoded: protoEncode(Protos.csgo.CPlayer_GetPlayerLinkDetails_Request, {
6716
+ steamids: steamIds,
6717
+ }).toString("base64"),
6718
+ };
6719
+
6720
+ const result = await this._httpRequest({
6721
+ url: `https://api.steampowered.com/IPlayerService/GetPlayerLinkDetails/v1?${Object.keys(params)
6722
+ .map((k) => `${k}=${encodeURIComponent(params[k])}`)
6723
+ .join("&")}`,
6724
+ responseType: "arraybuffer",
6725
+ });
6726
+ if (result instanceof ResponseError) {
6727
+ return result;
6728
+ }
6729
+
6730
+ return protoDecode(Protos.csgo.CPlayer_GetPlayerLinkDetails_Response, result.data)?.accounts?.map(function (account) {
6731
+ const public_data = account.public_data;
6732
+ const private_data = account.private_data;
6733
+ return {
6734
+ public_data: {
6735
+ ...public_data,
6736
+ steamId: public_data.steamid.toString(),
6737
+ avatarHash: account.public_data.sha_digest_avatar.toString("hex"),
6738
+ },
6739
+ private_data: {
6740
+ ...private_data,
6741
+ game_id: parseInt(private_data.game_id),
6742
+ lobby_steam_id: parseInt(private_data.lobby_steam_id),
6743
+ },
6744
+ };
6745
+ });
6746
+ const example = [
6747
+ {
6748
+ public_data: {
6749
+ visibility_state: 3,
6750
+ privacy_state: 0,
6751
+ profile_state: 1,
6752
+ ban_expires_time: 0,
6753
+ account_flags: 0,
6754
+ persona_name: "LOL haha",
6755
+ profile_url: "",
6756
+ content_country_restricted: false,
6757
+ steamId: "76561199243542939",
6758
+ avatarHash: "0000000000000000000000000000000000000000",
6759
+ },
6760
+ private_data: {
6761
+ persona_state: 0,
6762
+ persona_state_flags: 0,
6763
+ time_created: 1644675779,
6764
+ game_id: 0,
6765
+ game_server_ip_address: 0,
6766
+ game_server_port: 0,
6767
+ game_extra_info: "",
6768
+ account_name: "",
6769
+ lobby_steam_id: 0,
6770
+ rich_presence_kv: "",
6771
+ watching_broadcast_accountid: 0,
6772
+ watching_broadcast_appid: 0,
6773
+ watching_broadcast_viewers: 0,
6774
+ watching_broadcast_title: "",
6775
+ last_logoff_time: 0,
6776
+ last_seen_online: 0,
6777
+ game_os_type: 0,
6778
+ game_device_type: 0,
6779
+ game_device_name: "",
6780
+ game_is_private: false,
6781
+ },
6782
+ },
6783
+ ];
6784
+ }
6785
+ async getPurchaseHistory() {
6786
+ const result = await this._httpRequest({
6787
+ url: `https://store.steampowered.com/account/history/`,
6788
+ });
6789
+ if (result instanceof ResponseError) {
6790
+ return result;
6791
+ }
6792
+
6793
+ if (!result?.data || typeof result?.data !== "string") {
6794
+ return;
6795
+ }
6796
+
6797
+ const $ = cheerio.load(result?.data);
6798
+ return $(".wallet_history_table").html();
6799
+ /*
6800
+ const result = await this._httpRequestAjax({
6801
+ url: `https://store.steampowered.com/account/AjaxLoadMoreHistory/`,
6802
+ method: "POST",
6803
+ data: {
6804
+ cursor,
6805
+ },
6806
+ });
6807
+ * */
6808
+ }
6622
6809
  }
6623
6810
 
6624
6811
  SteamUser.MAX_RETRY = 10;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.3.69",
3
+ "version": "1.3.71",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.6",