steamutils 1.2.4 → 1.2.5

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 (2) hide show
  1. package/index.js +23 -8
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -962,6 +962,7 @@ class SteamUser {
962
962
  const name = $('.persona_name .actual_persona_name').text().trim()
963
963
  const $personaLevel = $('.persona_level .friendPlayerLevelNum')
964
964
  const level = $personaLevel.length ? parseInt($personaLevel.text()) : null
965
+ const notYetSetup = NotYetSetupProfileTextList.includes(profile_private_info)
965
966
 
966
967
  const g_rgProfileDataExample = {
967
968
  url: 'https://steamcommunity.com/id/natri99/',
@@ -969,9 +970,23 @@ class SteamUser {
969
970
  personaname: 'Natri',
970
971
  summary: 'Sub: <a class="bb_link" href="https://steamcommunity.com/id/Natri2099/" target="_blank" rel="noreferrer" >https://steamcommunity.com/id/Natri2099/</a> ',
971
972
  }
972
- const g_rgProfileData = JSON_parse(html.substringBetweenOrNull('g_rgProfileData = ', '"};') + '"}')
973
- if (!g_rgProfileData) {
974
- return
973
+ let g_rgProfileData = JSON_parse(html.substringBetweenOrNull('g_rgProfileData = ', '"};') + '"}')
974
+ if (!g_rgProfileData && notYetSetup) {
975
+ const editLink = $('#btn > a').attr('href')
976
+ if (editLink?.endsWith("edit?welcomed=1")) {
977
+ const steamId = editLink.split('https://steamcommunity.com/profiles/')[1].split('/')[0]
978
+ const helloText = $('#hello').text()
979
+ let personaname = helloText.substring(helloText.indexOf(",") + 1).trim()
980
+ if (personaname.endsWith(".")) {
981
+ personaname = personaname.substring(0, text.length - 1).trim()
982
+ }
983
+ g_rgProfileData = {
984
+ url: 'https://steamcommunity.com/profiles/' + steamId,
985
+ steamid: steamId,
986
+ personaname,
987
+ summary: ''
988
+ }
989
+ }
975
990
  }
976
991
 
977
992
  const lobbyLink = $(`.profile_in_game_joingame a[href*='steam://joinlobby/']`).attr('href')
@@ -1015,7 +1030,7 @@ class SteamUser {
1015
1030
  }
1016
1031
 
1017
1032
  return {
1018
- name: g_rgProfileData.personaname,
1033
+ name: g_rgProfileData.personaname || '',
1019
1034
  realname: $('.header_real_name bdi').text()?.trim() || '',
1020
1035
  onlineState,
1021
1036
  steamID: g_rgProfileData.steamid,
@@ -1024,10 +1039,10 @@ class SteamUser {
1024
1039
  customURL,
1025
1040
  location,
1026
1041
  summary: SteamUser._formatSummary(g_rgProfileData.summary),
1027
- notYetSetup: NotYetSetupProfileTextList.includes(profile_private_info),
1028
- profile_private_info: profile_private_info ? ((NotYetSetupProfileTextList.includes(profile_private_info)
1029
- ? '___NotYetSetupProfile___'
1030
- : (PrivateProfileTextList.includes(profile_private_info) ? '___PrivateProfile___' : profile_private_info))) : null,
1042
+ notYetSetup,
1043
+ profile_private_info: profile_private_info ? ((notYetSetup
1044
+ ? '___NotYetSetupProfile___'
1045
+ : (PrivateProfileTextList.includes(profile_private_info) ? '___PrivateProfile___' : profile_private_info))) : null,
1031
1046
  lobbyLink,
1032
1047
  addFriendEnable,
1033
1048
  isPrivate: PrivateProfileTextList.includes(profile_private_info),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.2.04",
3
+ "version": "1.2.05",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "axios": "^1.3.4",