steamutils 1.3.10 → 1.3.13

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 +27 -12
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -6134,19 +6134,34 @@ class SteamUser {
6134
6134
  continue_text
6135
6135
  } = data
6136
6136
  const $ = cheerio.load(StringUtils.cleanSpace(html))
6137
- const json = table2json($, $('table'))
6138
- if (Array.isArray(json)) {
6139
- json.forEach(function (row) {
6140
- row.Timestamp = moment.utc(row.Time.replace('GMT', '').trim(), 'YYYY-MM-DD HH:mm:ss', true).valueOf()
6137
+ $('th').parent().remove()
6138
+ const reports = []
6139
+ $('tr').each(function (index, el) {
6140
+ el = $(el)
6141
+ const childs = el.children()
6142
+ const time = $(childs[0]).text()
6143
+ const timestamp = moment.utc(time.replace('GMT', '').trim(), 'YYYY-MM-DD HH:mm:ss', true).valueOf()
6144
+ const playerEl = $(childs[1])
6145
+ const reportContents = [...$(childs[2]).find('li')].map(li => $(li).text())
6146
+ const playerAvatar = playerEl.find('img[src]').attr('src')
6147
+ const playerMiniprofile = playerEl.find('img[src]').attr('data-miniprofile')
6148
+ const playerURL = playerEl.find('a[href]').attr('href')
6149
+ const playerName = playerEl.find('.playerNickname > a[href]').text()
6150
+ reports.push({
6151
+ time,
6152
+ timestamp,
6153
+ player: {
6154
+ avatar: playerAvatar,
6155
+ avatarHash: SteamUser.GetAvatarHashFromURL(playerAvatar),
6156
+ steamId: SteamUser.miniprofile2SteamID64(playerMiniprofile),
6157
+ miniprofile: playerMiniprofile,
6158
+ url: playerURL,
6159
+ name: playerName,
6160
+ }
6161
+ reportContents,
6141
6162
  })
6142
- return json
6143
- }
6144
- /*const exampleData = [{
6145
- "Time": "2023-11-11 19:34:42 GMT",
6146
- Timestamp: 1699731282000,
6147
- "Reported Player": "N1k0-",
6148
- "Report Details": "You reported this player for: Aim HackingWall Hacking"
6149
- }]*/
6163
+ })
6164
+ return reports;
6150
6165
  }
6151
6166
  }
6152
6167
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.3.10",
3
+ "version": "1.3.13",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.5",