steamutils 1.3.10 → 1.3.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +24 -12
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -6134,19 +6134,31 @@ 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
+ playerAvatar,
6154
+ playerAvatarHash: SteamUser.GetAvatarHashFromURL(playerAvatar),
6155
+ playerMiniprofile,
6156
+ playerURL,
6157
+ playerName,
6158
+ reportContents,
6141
6159
  })
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
- }]*/
6160
+ })
6161
+ return reports;
6150
6162
  }
6151
6163
  }
6152
6164
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.3.10",
3
+ "version": "1.3.12",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.5",