steamutils 1.3.70 → 1.3.72

Sign up to get free protection for your applications and to get access to all the features.
Files changed (240) hide show
  1. package/.idea/codeStyles/Project.xml +58 -0
  2. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  3. package/.idea/deployment.xml +1 -8
  4. package/.idea/steamutils.iml +1 -1
  5. package/.idea/vcs.xml +1 -1
  6. package/.prettierrc.json +3 -3
  7. package/SteamClient.js +2416 -2417
  8. package/bufferHelpers.js +115 -115
  9. package/cheerio.js +103 -103
  10. package/const.js +336 -336
  11. package/create_remote_file.js +66 -66
  12. package/free_packages.json +10048 -10048
  13. package/index.js +311 -2
  14. package/package.json +1 -1
  15. package/protos/csgo/base_gcmessages.proto +553 -553
  16. package/protos/csgo/base_gcmessages_csgo.proto +547 -547
  17. package/protos/csgo/c_peer2peer_netmessages.proto +55 -55
  18. package/protos/csgo/clientmessages.proto +48 -48
  19. package/protos/csgo/connectionless_netmessages.proto +17 -17
  20. package/protos/csgo/cs_gameevents.proto +35 -35
  21. package/protos/csgo/cs_usercmd.proto +34 -34
  22. package/protos/csgo/cstrike15_gcmessages.proto +1431 -1431
  23. package/protos/csgo/cstrike15_usermessages.proto +592 -592
  24. package/protos/csgo/demo.proto +165 -165
  25. package/protos/csgo/econ_gcmessages.proto +219 -219
  26. package/protos/csgo/engine_gcmessages.proto +14 -14
  27. package/protos/csgo/enums_clientserver.proto +1529 -1529
  28. package/protos/csgo/fatdemo.proto +125 -125
  29. package/protos/csgo/gameevents.proto +120 -120
  30. package/protos/csgo/gcsdk_gcmessages.proto +323 -323
  31. package/protos/csgo/gcsystemmsgs.proto +243 -243
  32. package/protos/csgo/netmessages.proto +618 -618
  33. package/protos/csgo/network_connection.proto +126 -126
  34. package/protos/csgo/networkbasetypes.proto +246 -246
  35. package/protos/csgo/networksystem_protomessages.proto +17 -17
  36. package/protos/csgo/steamdatagram_messages_auth.proto +65 -65
  37. package/protos/csgo/steamdatagram_messages_sdr.proto +534 -534
  38. package/protos/csgo/steammessages.proto +620 -620
  39. package/protos/csgo/steammessages_base.proto +301 -301
  40. package/protos/csgo/steammessages_cloud.steamworkssdk.proto +68 -68
  41. package/protos/csgo/steammessages_gamenetworkingui.proto +61 -61
  42. package/protos/csgo/steammessages_helprequest.steamworkssdk.proto +22 -22
  43. package/protos/csgo/steammessages_oauth.steamworkssdk.proto +18 -18
  44. package/protos/csgo/steammessages_player.steamworkssdk.proto +254 -254
  45. package/protos/csgo/steammessages_publishedfile.steamworkssdk.proto +233 -233
  46. package/protos/csgo/steammessages_unified_base.steamworkssdk.proto +30 -30
  47. package/protos/csgo/steamnetworkingsockets_messages.proto +205 -205
  48. package/protos/csgo/steamnetworkingsockets_messages_certs.proto +39 -39
  49. package/protos/csgo/steamnetworkingsockets_messages_udp.proto +75 -75
  50. package/protos/csgo/te.proto +259 -259
  51. package/protos/csgo/uifontfile_format.proto +13 -13
  52. package/protos/csgo/usercmd.proto +39 -39
  53. package/protos/csgo/usermessages.proto +752 -752
  54. package/protos/csgo/valveextensions.proto +17 -17
  55. package/protos/google/protobuf/descriptor.proto +281 -281
  56. package/protos/steam/clientmetrics.proto +45 -45
  57. package/protos/steam/content_manifest.proto +62 -62
  58. package/protos/steam/contenthubs.proto +41 -41
  59. package/protos/steam/encrypted_app_ticket.proto +10 -10
  60. package/protos/steam/enums.proto +501 -501
  61. package/protos/steam/enums_clientserver.proto +1508 -1508
  62. package/protos/steam/enums_productinfo.proto +14 -14
  63. package/protos/steam/htmlmessages.proto +1039 -1039
  64. package/protos/steam/offline_ticket.proto +8 -8
  65. package/protos/steam/steamdatagram_messages_auth.proto +65 -65
  66. package/protos/steam/steamdatagram_messages_sdr.proto +533 -533
  67. package/protos/steam/steammessages_accounthardware.steamclient.proto +167 -167
  68. package/protos/steam/steammessages_appoverview.proto +204 -204
  69. package/protos/steam/steammessages_auth.steamclient.proto +375 -375
  70. package/protos/steam/steammessages_base.proto +335 -335
  71. package/protos/steam/steammessages_broadcast.steamclient.proto +618 -618
  72. package/protos/steam/steammessages_chat.steamclient.proto +1070 -1070
  73. package/protos/steam/steammessages_client_objects.proto +649 -649
  74. package/protos/steam/steammessages_clientlanp2p.proto +43 -43
  75. package/protos/steam/steammessages_clientmetrics.steamclient.proto +192 -192
  76. package/protos/steam/steammessages_clientnotificationtypes.proto +250 -250
  77. package/protos/steam/steammessages_clientserver.proto +392 -392
  78. package/protos/steam/steammessages_clientserver_2.proto +771 -771
  79. package/protos/steam/steammessages_clientserver_appinfo.proto +131 -131
  80. package/protos/steam/steammessages_clientserver_friends.proto +260 -260
  81. package/protos/steam/steammessages_clientserver_gameservers.proto +159 -159
  82. package/protos/steam/steammessages_clientserver_lbs.proto +70 -70
  83. package/protos/steam/steammessages_clientserver_login.proto +167 -167
  84. package/protos/steam/steammessages_clientserver_mms.proto +233 -233
  85. package/protos/steam/steammessages_clientserver_ucm.proto +207 -207
  86. package/protos/steam/steammessages_clientserver_uds.proto +125 -125
  87. package/protos/steam/steammessages_clientserver_ufs.proto +45 -45
  88. package/protos/steam/steammessages_clientserver_userstats.proto +80 -80
  89. package/protos/steam/steammessages_clientsettings.proto +208 -208
  90. package/protos/steam/steammessages_cloud.steamclient.proto +422 -422
  91. package/protos/steam/steammessages_contentsystem.steamclient.proto +123 -123
  92. package/protos/steam/steammessages_credentials.steamclient.proto +96 -96
  93. package/protos/steam/steammessages_datapublisher.steamclient.proto +102 -102
  94. package/protos/steam/steammessages_depotbuilder.steamclient.proto +99 -99
  95. package/protos/steam/steammessages_deviceauth.steamclient.proto +169 -169
  96. package/protos/steam/steammessages_econ.steamclient.proto +137 -137
  97. package/protos/steam/steammessages_familygroups.steamclient.proto +441 -441
  98. package/protos/steam/steammessages_friendmessages.steamclient.proto +141 -141
  99. package/protos/steam/steammessages_gamenetworking.steamclient.proto +25 -25
  100. package/protos/steam/steammessages_gamenetworkingui.proto +61 -61
  101. package/protos/steam/steammessages_gamenotifications.steamclient.proto +131 -131
  102. package/protos/steam/steammessages_gameservers.steamclient.proto +136 -136
  103. package/protos/steam/steammessages_hiddevices.proto +157 -157
  104. package/protos/steam/steammessages_inventory.steamclient.proto +172 -172
  105. package/protos/steam/steammessages_linkfilter.steamclient.proto +39 -39
  106. package/protos/steam/steammessages_lobbymatchmaking.steamclient.proto +29 -29
  107. package/protos/steam/steammessages_market.steamclient.proto +22 -22
  108. package/protos/steam/steammessages_marketingmessages.steamclient.proto +273 -273
  109. package/protos/steam/steammessages_offline.steamclient.proto +33 -33
  110. package/protos/steam/steammessages_parental.steamclient.proto +262 -262
  111. package/protos/steam/steammessages_parties.steamclient.proto +75 -75
  112. package/protos/steam/steammessages_partnerapps.steamclient.proto +106 -106
  113. package/protos/steam/steammessages_player.steamclient.proto +915 -915
  114. package/protos/steam/steammessages_publishedfile.steamclient.proto +737 -737
  115. package/protos/steam/steammessages_qms.steamclient.proto +111 -111
  116. package/protos/steam/steammessages_remoteclient.proto +100 -100
  117. package/protos/steam/steammessages_remoteclient_discovery.proto +244 -244
  118. package/protos/steam/steammessages_remoteclient_service.steamclient.proto +31 -31
  119. package/protos/steam/steammessages_remoteclient_service_messages.proto +217 -217
  120. package/protos/steam/steammessages_remoteplay.proto +975 -975
  121. package/protos/steam/steammessages_secrets.steamclient.proto +35 -35
  122. package/protos/steam/steammessages_shader.steamclient.proto +89 -89
  123. package/protos/steam/steammessages_site_license.steamclient.proto +103 -103
  124. package/protos/steam/steammessages_sitelicenseclient.proto +38 -38
  125. package/protos/steam/steammessages_siteserverui.proto +130 -130
  126. package/protos/steam/steammessages_steamtv.steamclient.proto +533 -533
  127. package/protos/steam/steammessages_store.steamclient.proto +404 -404
  128. package/protos/steam/steammessages_storebrowse.steamclient.proto +457 -457
  129. package/protos/steam/steammessages_timedtrial.steamclient.proto +40 -40
  130. package/protos/steam/steammessages_twofactor.steamclient.proto +157 -157
  131. package/protos/steam/steammessages_unified_base.steamclient.proto +45 -45
  132. package/protos/steam/steammessages_unified_test.steamclient.proto +51 -51
  133. package/protos/steam/steammessages_useraccount.steamclient.proto +211 -211
  134. package/protos/steam/steammessages_vac.steamclient.proto +37 -37
  135. package/protos/steam/steammessages_video.steamclient.proto +68 -68
  136. package/protos/steam/steammessages_virtualcontroller.proto +138 -138
  137. package/protos/steam/steammessages_workshop.steamclient.proto +19 -19
  138. package/protos/steam/steamnetworkingsockets_messages.proto +205 -205
  139. package/protos/steam/steamnetworkingsockets_messages_certs.proto +39 -39
  140. package/protos/steam/steamnetworkingsockets_messages_udp.proto +75 -75
  141. package/protos/steam/webuimessages_achievements.proto +29 -29
  142. package/protos/steam/webuimessages_base.proto +24 -24
  143. package/protos/steam/webuimessages_gamenotes.proto +21 -21
  144. package/protos/steam/webuimessages_gamescope.proto +57 -57
  145. package/protos/steam/webuimessages_steamengine.proto +41 -41
  146. package/protos/steam/webuimessages_steamos.proto +114 -114
  147. package/protos/steam/webuimessages_storagedevicemanager.proto +110 -110
  148. package/protos/steam/webuimessages_systemmanager.proto +17 -17
  149. package/protos/steam/webuimessages_transport.proto +22 -22
  150. package/protos/steam/webuimessages_transportvalidation.proto +111 -111
  151. package/protos/webui/common.proto +4024 -0
  152. package/protos/webui/common_base.proto +27 -0
  153. package/protos/webui/service_accountcart.proto +153 -0
  154. package/protos/webui/service_accountlinking.proto +27 -0
  155. package/protos/webui/service_accountprivacy.proto +42 -0
  156. package/protos/webui/service_accountprivateapps.proto +34 -0
  157. package/protos/webui/service_auction.proto +97 -0
  158. package/protos/webui/service_authentication.proto +222 -0
  159. package/protos/webui/service_authenticationsupport.proto +74 -0
  160. package/protos/webui/service_broadcast.proto +562 -0
  161. package/protos/webui/service_chat.proto +11 -0
  162. package/protos/webui/service_chatroom.proto +810 -0
  163. package/protos/webui/service_chatusability.proto +107 -0
  164. package/protos/webui/service_checkout.proto +84 -0
  165. package/protos/webui/service_clan.proto +41 -0
  166. package/protos/webui/service_clanchatrooms.proto +25 -0
  167. package/protos/webui/service_clanfaqs.proto +202 -0
  168. package/protos/webui/service_clientcomm.proto +151 -0
  169. package/protos/webui/service_clientmetrics.proto +22 -0
  170. package/protos/webui/service_cloud.proto +222 -0
  171. package/protos/webui/service_cloudconfigstore.proto +51 -0
  172. package/protos/webui/service_cloudgaming.proto +30 -0
  173. package/protos/webui/service_community.proto +365 -0
  174. package/protos/webui/service_dailydeal.proto +89 -0
  175. package/protos/webui/service_econ.proto +134 -0
  176. package/protos/webui/service_embedded.proto +24 -0
  177. package/protos/webui/service_experimentservice.proto +6 -0
  178. package/protos/webui/service_familygroups.proto +355 -0
  179. package/protos/webui/service_fovasvideo.proto +15 -0
  180. package/protos/webui/service_friendmessages.proto +133 -0
  181. package/protos/webui/service_friendslist.proto +70 -0
  182. package/protos/webui/service_gamenotes.proto +15 -0
  183. package/protos/webui/service_gamerecording.proto +265 -0
  184. package/protos/webui/service_gamerecordingclip.proto +85 -0
  185. package/protos/webui/service_gamerecordingdebug.proto +52 -0
  186. package/protos/webui/service_helprequestlogs.proto +16 -0
  187. package/protos/webui/service_loyaltyrewards.proto +252 -0
  188. package/protos/webui/service_marketingmessages.proto +215 -0
  189. package/protos/webui/service_mobileapp.proto +18 -0
  190. package/protos/webui/service_mobileauth.proto +24 -0
  191. package/protos/webui/service_mobiledevice.proto +26 -0
  192. package/protos/webui/service_mobileperaccount.proto +31 -0
  193. package/protos/webui/service_news.proto +110 -0
  194. package/protos/webui/service_parental.proto +258 -0
  195. package/protos/webui/service_partnermembershipinvite.proto +34 -0
  196. package/protos/webui/service_partnerstorebrowse.proto +28 -0
  197. package/protos/webui/service_phone.proto +51 -0
  198. package/protos/webui/service_physicalgoods.proto +15 -0
  199. package/protos/webui/service_player.proto +918 -0
  200. package/protos/webui/service_promotioneventinvites.proto +109 -0
  201. package/protos/webui/service_promotionplanning.proto +186 -0
  202. package/protos/webui/service_promotionstats.proto +23 -0
  203. package/protos/webui/service_publishedfile.proto +714 -0
  204. package/protos/webui/service_publishing.proto +200 -0
  205. package/protos/webui/service_quest.proto +127 -0
  206. package/protos/webui/service_salefeature.proto +373 -0
  207. package/protos/webui/service_saleitemrewards.proto +54 -0
  208. package/protos/webui/service_shoppingcart.proto +152 -0
  209. package/protos/webui/service_steamawards.proto +76 -0
  210. package/protos/webui/service_steamcharts.proto +75 -0
  211. package/protos/webui/service_steamengine.proto +36 -0
  212. package/protos/webui/service_steamlearn.proto +876 -0
  213. package/protos/webui/service_steamnotification.proto +73 -0
  214. package/protos/webui/service_steamtv.proto +495 -0
  215. package/protos/webui/service_steamvrvoicechat.proto +67 -0
  216. package/protos/webui/service_steamvrwebrtc.proto +48 -0
  217. package/protos/webui/service_storagedevicemanager.proto +104 -0
  218. package/protos/webui/service_store.proto +359 -0
  219. package/protos/webui/service_storeappsimilarity.proto +76 -0
  220. package/protos/webui/service_storebrowse.proto +103 -0
  221. package/protos/webui/service_storemarketing.proto +44 -0
  222. package/protos/webui/service_storequery.proto +103 -0
  223. package/protos/webui/service_storesales.proto +87 -0
  224. package/protos/webui/service_storetopsellers.proto +44 -0
  225. package/protos/webui/service_systemmanager.proto +11 -0
  226. package/protos/webui/service_test_transporterror.proto +6 -0
  227. package/protos/webui/service_transportauth.proto +17 -0
  228. package/protos/webui/service_transportvalidation.proto +69 -0
  229. package/protos/webui/service_twofactor.proto +170 -0
  230. package/protos/webui/service_useraccount.proto +142 -0
  231. package/protos/webui/service_usergameactivity.proto +34 -0
  232. package/protos/webui/service_usergamenotes.proto +70 -0
  233. package/protos/webui/service_usernews.proto +68 -0
  234. package/protos/webui/service_userreviews.proto +97 -0
  235. package/protos/webui/service_video.proto +50 -0
  236. package/protos/webui/service_videoclip.proto +62 -0
  237. package/protos/webui/service_voicechat.proto +139 -0
  238. package/protos/webui/service_webrtc.proto +52 -0
  239. package/remote.js +5766 -5766
  240. package/test_steamclient.js +9 -0
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;
@@ -6620,6 +6623,312 @@ export default class SteamUser {
6620
6623
  const help_request_page = $(".help_request_page");
6621
6624
  return help_request_page.html();
6622
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 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
+ }
6873
+ async getPurchaseHistory() {
6874
+ const result = await this._httpRequest({
6875
+ url: `https://store.steampowered.com/account/history/`,
6876
+ });
6877
+ if (result instanceof ResponseError) {
6878
+ return result;
6879
+ }
6880
+
6881
+ if (!result?.data || typeof result?.data !== "string") {
6882
+ return;
6883
+ }
6884
+
6885
+ const $ = cheerio.load(result?.data);
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
+
6922
+ /*
6923
+ const result = await this._httpRequestAjax({
6924
+ url: `https://store.steampowered.com/account/AjaxLoadMoreHistory/`,
6925
+ method: "POST",
6926
+ data: {
6927
+ cursor,
6928
+ },
6929
+ });
6930
+ * */
6931
+ }
6623
6932
  }
6624
6933
 
6625
6934
  SteamUser.MAX_RETRY = 10;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.3.70",
3
+ "version": "1.3.72",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.6",