steamutils 1.1.55 → 1.1.56
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.
- package/.idea/steamutils.iml +1 -1
- package/.idea/vcs.xml +1 -1
- package/index.js +35 -25
- package/package.json +1 -1
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
package/.idea/steamutils.iml
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
<module type="WEB_MODULE" version="4">
|
3
3
|
<component name="NewModuleRootManager">
|
4
4
|
<content url="file://$MODULE_DIR$">
|
5
|
-
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
6
5
|
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
7
7
|
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
8
8
|
</content>
|
9
9
|
<orderEntry type="inheritedJdk" />
|
package/.idea/vcs.xml
CHANGED
package/index.js
CHANGED
@@ -593,6 +593,8 @@ class SteamUser {
|
|
593
593
|
sessionid,
|
594
594
|
} = SteamUser.parseCookie(this._cookies.toString())
|
595
595
|
|
596
|
+
this._myProfile = `profiles/${steamID}`
|
597
|
+
|
596
598
|
if (!sessionid) {
|
597
599
|
sessionid = SteamUser.generateSessionID()
|
598
600
|
this._cookies.setCookie("sessionid", sessionid)
|
@@ -684,12 +686,12 @@ class SteamUser {
|
|
684
686
|
return this._steamMachineAuth
|
685
687
|
}
|
686
688
|
|
687
|
-
getSteamUserProfileURL (steamID
|
689
|
+
getSteamUserProfileURL (steamID) {
|
688
690
|
return `profiles/${steamID}`
|
689
691
|
}
|
690
692
|
|
691
|
-
|
692
|
-
return this.
|
693
|
+
getMyProfileURL() {
|
694
|
+
return this._myProfile
|
693
695
|
}
|
694
696
|
|
695
697
|
/**
|
@@ -1530,9 +1532,17 @@ class SteamUser {
|
|
1530
1532
|
this._cookies.setCookies(response.headers["set-cookie"])
|
1531
1533
|
if (response.status === 302) {
|
1532
1534
|
redirectURL = response.headers.location
|
1535
|
+
|
1536
|
+
if (redirectURL?.startsWith('https://steamcommunity.com/id/')) {
|
1537
|
+
const customURL = redirectURL.split('/')[4];
|
1538
|
+
if (customURL) {
|
1539
|
+
this._myProfile = `id/${customURL}`
|
1540
|
+
}
|
1541
|
+
}
|
1542
|
+
|
1533
1543
|
console.log(`Redirect to ${redirectURL}`)
|
1534
1544
|
} else if (response.status === 200) {
|
1535
|
-
if(response.data && typeof response.data === 'string') {
|
1545
|
+
if (response.data && typeof response.data === 'string') {
|
1536
1546
|
response._$ = function () {
|
1537
1547
|
return cheerio.load(response.data
|
1538
1548
|
.replaceAll(/[\t\n\r]/gi, '')
|
@@ -2249,7 +2259,7 @@ class SteamUser {
|
|
2249
2259
|
if (!matchHistoryType) {
|
2250
2260
|
return
|
2251
2261
|
}
|
2252
|
-
let result = await this._httpRequest(`${this.
|
2262
|
+
let result = await this._httpRequest(`${this.getMyProfileURL()}/gcpd/${AppID_CSGO}/?tab=${matchHistoryType}`)
|
2253
2263
|
if (result?.data) {
|
2254
2264
|
const matches = this._parseMatchHistory(result?.data)
|
2255
2265
|
const continue_token = result.data.substringBetweenOrNull('var g_sGcContinueToken =', ';').trim().removeSurrounding('\'').trim()
|
@@ -2303,7 +2313,7 @@ class SteamUser {
|
|
2303
2313
|
i = MAX_RETRY
|
2304
2314
|
while (result?.data?.success !== true && i--) {
|
2305
2315
|
result = await _self._httpRequest(
|
2306
|
-
`${this.
|
2316
|
+
`${this.getMyProfileURL()}/gcpd/${AppID_CSGO}?ajax=1&tab=${matchHistoryType}${token ? `&continue_token=${token}` : ''}&sessionid=${_self._sessionid}`)
|
2307
2317
|
}
|
2308
2318
|
if (!result.data) {
|
2309
2319
|
return null
|
@@ -2582,7 +2592,7 @@ class SteamUser {
|
|
2582
2592
|
})
|
2583
2593
|
|
2584
2594
|
const { data } = await this._httpRequestAjax({
|
2585
|
-
url: `${this.
|
2595
|
+
url: `${this.getMyProfileURL()}/friends/action`,
|
2586
2596
|
method: 'POST',
|
2587
2597
|
data: formData,
|
2588
2598
|
})
|
@@ -2652,7 +2662,7 @@ class SteamUser {
|
|
2652
2662
|
|
2653
2663
|
async acceptFriendRequest (steamID) {
|
2654
2664
|
const { data } = await this._httpRequest({
|
2655
|
-
url: `${this.
|
2665
|
+
url: `${this.getMyProfileURL()}/friends/action`,
|
2656
2666
|
data: {
|
2657
2667
|
steamid: this._steamid_user,
|
2658
2668
|
ajax: 1,
|
@@ -2728,7 +2738,7 @@ class SteamUser {
|
|
2728
2738
|
|
2729
2739
|
async clearPreviousAliases () {
|
2730
2740
|
const { data } = await this._httpRequestAjax({
|
2731
|
-
url: `${this.
|
2741
|
+
url: `${this.getMyProfileURL()}/ajaxclearaliashistory/`,
|
2732
2742
|
method: 'POST',
|
2733
2743
|
headers: {
|
2734
2744
|
'Content-Type': 'multipart/form-data',
|
@@ -2754,7 +2764,7 @@ class SteamUser {
|
|
2754
2764
|
summary = null,
|
2755
2765
|
hide_profile_awards = null,
|
2756
2766
|
}) {
|
2757
|
-
const existProfile = await this._httpRequest(
|
2767
|
+
const existProfile = await this._httpRequest(`${this.getMyProfileURL()}/edit/info`)
|
2758
2768
|
if (!existProfile.data) {
|
2759
2769
|
return
|
2760
2770
|
}
|
@@ -2765,7 +2775,7 @@ class SteamUser {
|
|
2765
2775
|
}
|
2766
2776
|
|
2767
2777
|
const { data } = await this._httpRequestAjax({
|
2768
|
-
url: `${this.
|
2778
|
+
url: `${this.getMyProfileURL()}/edit/`,
|
2769
2779
|
method: 'POST',
|
2770
2780
|
data: {
|
2771
2781
|
type: 'profileSave',
|
@@ -2802,7 +2812,7 @@ class SteamUser {
|
|
2802
2812
|
|
2803
2813
|
async setPersonaName (name) {
|
2804
2814
|
const result = await this._httpRequestAjax({
|
2805
|
-
url: `${this.
|
2815
|
+
url: `${this.getMyProfileURL()}/ajaxsetpersonaname/`,
|
2806
2816
|
method: 'POST',
|
2807
2817
|
data: {
|
2808
2818
|
persona: name,
|
@@ -2873,7 +2883,7 @@ class SteamUser {
|
|
2873
2883
|
|
2874
2884
|
async getPrivacySettings () {
|
2875
2885
|
const result = await this._httpRequest({
|
2876
|
-
url: `${this.
|
2886
|
+
url: `${this.getMyProfileURL()}/edit/settings`,
|
2877
2887
|
})
|
2878
2888
|
|
2879
2889
|
if (!result.data) {
|
@@ -2982,7 +2992,7 @@ class SteamUser {
|
|
2982
2992
|
const {
|
2983
2993
|
data,
|
2984
2994
|
} = await this._httpRequestAjax({
|
2985
|
-
url: `${this.
|
2995
|
+
url: `${this.getMyProfileURL()}/ajaxsetprivacy`,
|
2986
2996
|
method: 'POST',
|
2987
2997
|
data: {
|
2988
2998
|
Privacy: JSON.stringify(privacyValue.PrivacySettings),
|
@@ -3134,7 +3144,7 @@ class SteamUser {
|
|
3134
3144
|
return
|
3135
3145
|
}
|
3136
3146
|
const _self = this
|
3137
|
-
const result = await this._httpRequest(`${this.
|
3147
|
+
const result = await this._httpRequest(`${this.getMyProfileURL()}/friendsthatplay/${appID}`)
|
3138
3148
|
const data = {
|
3139
3149
|
YourOwnPlaytime: [],//Your own playtime _
|
3140
3150
|
FriendsCurrentlyPlaying: [],//Friends currently playing Counter-Strike: Global Offensive_
|
@@ -3236,7 +3246,7 @@ class SteamUser {
|
|
3236
3246
|
}
|
3237
3247
|
|
3238
3248
|
async getOwnedAppsDetail () {
|
3239
|
-
const response = await this._httpRequest(`${this.
|
3249
|
+
const response = await this._httpRequest(`${this.getMyProfileURL()}/games/?tab=all`)
|
3240
3250
|
|
3241
3251
|
let rgGames = response?.data?.substringBetweenOrNull('var rgGames = ', 'var rgChangingGames = []')?.trim()?.removeSuffix(';')?.trim()
|
3242
3252
|
if (!rgGames) {
|
@@ -3399,7 +3409,7 @@ class SteamUser {
|
|
3399
3409
|
|
3400
3410
|
async _respondToGroupInvite (groupSteamID, accept) {
|
3401
3411
|
const { data } = await this._httpRequestAjax({
|
3402
|
-
url: `${this.
|
3412
|
+
url: `${this.getMyProfileURL()}/friends/action`,
|
3403
3413
|
data: {
|
3404
3414
|
steamid: this.getSteamidUser(),
|
3405
3415
|
ajax: 1,
|
@@ -3448,7 +3458,7 @@ class SteamUser {
|
|
3448
3458
|
|
3449
3459
|
async leaveGroup (groupSteamID) {
|
3450
3460
|
const { data } = await this._httpRequestAjax({
|
3451
|
-
url: `${this.
|
3461
|
+
url: `${this.getMyProfileURL()}/friends/action`,
|
3452
3462
|
data: {
|
3453
3463
|
steamid: this.getSteamidUser(),
|
3454
3464
|
ajax: 1,
|
@@ -3796,7 +3806,7 @@ class SteamUser {
|
|
3796
3806
|
const activity = []
|
3797
3807
|
let next_request_timestart = null,
|
3798
3808
|
next_request = null
|
3799
|
-
const { data } = await this._httpRequestAjax(typeof start_or_url === 'string' ? start_or_url :
|
3809
|
+
const { data } = await this._httpRequestAjax(typeof start_or_url === 'string' ? start_or_url : `${this.getMyProfileURL()}/ajaxgetusernews/?start=${start_or_url}`)//use my, not profiles/76561197977736539 getMySteamUserProfileURL
|
3800
3810
|
if (data?.success) {
|
3801
3811
|
next_request = data.next_request || null
|
3802
3812
|
next_request_timestart = parseInt(next_request.substringAfterLast('?start=')) || null
|
@@ -4121,7 +4131,7 @@ class SteamUser {
|
|
4121
4131
|
|
4122
4132
|
async getCurrentSteamLogin () {
|
4123
4133
|
const result = await this._httpRequest({
|
4124
|
-
url: `${this.
|
4134
|
+
url: `${this.getMyProfileURL()}/games/?tab=all`,
|
4125
4135
|
})
|
4126
4136
|
const $ = result._$()
|
4127
4137
|
return $('.clientConnMachineText').text()?.trim()?.substringBeforeLast('|')?.trim()
|
@@ -4214,7 +4224,7 @@ class SteamUser {
|
|
4214
4224
|
//Personal Game Data
|
4215
4225
|
async getCompetitiveCooldownLevel () {
|
4216
4226
|
const result = await this._httpRequest({
|
4217
|
-
url: `${this.
|
4227
|
+
url: `${this.getMyProfileURL()}/gcpd/730/?tab=matchmaking`,
|
4218
4228
|
})
|
4219
4229
|
const $ = result._$()
|
4220
4230
|
|
@@ -4296,7 +4306,7 @@ class SteamUser {
|
|
4296
4306
|
|
4297
4307
|
async getPersonalGameDataAccountInformation () {
|
4298
4308
|
const result = await this._httpRequest({
|
4299
|
-
url: `${this.
|
4309
|
+
url: `${this.getMyProfileURL()}/gcpd/730/?tab=accountmain`,
|
4300
4310
|
})
|
4301
4311
|
if (!result?.data) {
|
4302
4312
|
return
|
@@ -4976,7 +4986,7 @@ class SteamUser {
|
|
4976
4986
|
|
4977
4987
|
async getInventoryTrading (appID) {
|
4978
4988
|
for (let i = 0; i < 10; i++) {
|
4979
|
-
const url = `${this.
|
4989
|
+
const url = `${this.getMyProfileURL()}/inventory/json/${appID}/2?l=english&trading=1`;
|
4980
4990
|
const _result = (await this._httpRequestAjax(url))?.data
|
4981
4991
|
if (!_result) {
|
4982
4992
|
await sleep(5000)
|
@@ -5179,7 +5189,7 @@ class SteamUser {
|
|
5179
5189
|
query['cursor[time_frac]'] = cursor.time_frac
|
5180
5190
|
query['cursor[time]'] = cursor.time
|
5181
5191
|
}
|
5182
|
-
const url =
|
5192
|
+
const url = `${this.getMyProfileURL()}/inventoryhistory/?${Object.keys(query).map(k => `${encodeURIComponent(k)}=${encodeURIComponent(query[k])}`).join('&')}`;
|
5183
5193
|
let _result
|
5184
5194
|
try {
|
5185
5195
|
_result = (await this._httpRequestAjax({url}))?.data
|
@@ -5427,7 +5437,7 @@ class SteamUser {
|
|
5427
5437
|
}
|
5428
5438
|
|
5429
5439
|
async getTradeURL(){
|
5430
|
-
const result = await this._httpRequest(`${this.
|
5440
|
+
const result = await this._httpRequest(`${this.getMyProfileURL()}/tradeoffers/privacy`)
|
5431
5441
|
const $ = cherrio.load(result.data)
|
5432
5442
|
const trade_offer_access_url = $('#trade_offer_access_url').attr('value')
|
5433
5443
|
return trade_offer_access_url
|
package/package.json
CHANGED