steamutils 1.0.46 → 1.0.48

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/SteamClient.js CHANGED
@@ -183,8 +183,8 @@ function SteamClient({
183
183
  return [steamClient?.accountInfo?.name, steamClient?._logOnDetails?.account_name].filter(Boolean).join(" - ")
184
184
  }
185
185
 
186
- function log(msg) {
187
- console.log(`[${getAccountInfoName()}] ${msg}`)
186
+ function log(...msg) {
187
+ console.log(`[${getAccountInfoName()}]`, ...msg)
188
188
  }
189
189
 
190
190
  async function getPersonas(steamIDs) {
@@ -331,7 +331,7 @@ function SteamClient({
331
331
  if (player_name === undefined) {
332
332
  log(sid64, personas);
333
333
  }
334
- log(getAccountInfoName(), player_name, `https://steamcommunity.com/profiles/${sid64}`);
334
+ log(player_name, `https://steamcommunity.com/profiles/${sid64}`);
335
335
  // joinLobby(msg.lobbyid, msg.accountid)
336
336
  break
337
337
  }
@@ -829,7 +829,7 @@ function SteamClient({
829
829
  await sleep(20000)
830
830
  const ownedAppsCount2 = (await steamUtils.getDynamicStoreUserData())?.rgOwnedApps?.length || 0
831
831
  const increaseNumber = ownedAppsCount2 - ownedAppsCount;
832
- log(getAccountInfoName(), `OwnedApps length ${ownedAppsCount2}, increase ${increaseNumber}`)
832
+ log(`OwnedApps length ${ownedAppsCount2}, increase ${increaseNumber}`)
833
833
  }
834
834
  }
835
835
 
package/example.js CHANGED
@@ -1,13 +1,25 @@
1
1
  import SteamUser from "./index.js";
2
+ import Steamutils from "./index.js";
2
3
 
3
4
  (async function () {
4
- const loginResult = await SteamUser.communityLogin({
5
- username: "abc",
6
- password: "xyz",
7
- })
8
- console.log(loginResult.cookie);
9
- const user = new SteamUser(loginResult.cookie)
10
- const friendList = await user.turningSteamGuardOff()
5
+ // const loginResult = await SteamUser.communityLogin({
6
+ // username: "abc",
7
+ // password: "xyz",
8
+ // })
9
+ // console.log(loginResult.cookie);
10
+ // const user = new SteamUser(loginResult.cookie)
11
+ // const friendList = await user.turningSteamGuardOff()
11
12
  // const friendList = await user.turningEmailAuthenticatorCheckOn()
12
- console.log(friendList);
13
+ // console.log(friendList);
14
+
15
+
16
+ const user = new Steamutils([
17
+ "Steam_Language=english",
18
+ "timezoneOffset=0,0",
19
+ "steamCountry=VN%7C3c7bd5df99a265a3e5102a225d1ab62d",
20
+ "steamLoginSecure=76561199503410145%7C%7C82A70985FC6EDB855F20317D1376BB436866997E",
21
+ "sessionid=46f8f237c39047bae7892f97"
22
+ ])
23
+ const email = await user.getAccountEmail()
24
+ console.log(email);
13
25
  })()
package/index.js CHANGED
@@ -4363,6 +4363,24 @@ class SteamUser {
4363
4363
  daysSinceLastBan
4364
4364
  }
4365
4365
  }
4366
+
4367
+ async getAccountEmail() {
4368
+ const result = await this._httpRequest('https://store.steampowered.com/account/')
4369
+ if (!result.data) {
4370
+ return
4371
+ }
4372
+ const $ = result._$()
4373
+ let email = ''
4374
+ $('.account_setting_block').each(function () {
4375
+ if (email) return
4376
+ const account_setting_block = $(this)
4377
+ const account_data_field = account_setting_block.find('.account_manage_label + span.account_data_field')
4378
+ if (account_data_field.prev().text()?.trim() == 'Email address:') {
4379
+ email = account_data_field.text()
4380
+ }
4381
+ })
4382
+ return email
4383
+ }
4366
4384
  }
4367
4385
 
4368
4386
  export default SteamUser
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.0.46",
3
+ "version": "1.0.48",
4
4
  "dependencies": {
5
5
  "axios": "^1.3.4",
6
6
  "cheerio": "^1.0.0-rc.12",