steamutils 1.3.9 → 1.3.12
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +50 -3
- package/package.json +1 -1
package/index.js
CHANGED
@@ -1676,7 +1676,7 @@ class SteamUser {
|
|
1676
1676
|
|
1677
1677
|
switch (response.status) {
|
1678
1678
|
case 302: {
|
1679
|
-
if(isRedirect){
|
1679
|
+
if (isRedirect) {
|
1680
1680
|
redirectURL = response.headers.location
|
1681
1681
|
|
1682
1682
|
if (redirectURL?.startsWith('https://steamcommunity.com/id/')) {
|
@@ -1731,7 +1731,7 @@ class SteamUser {
|
|
1731
1731
|
}
|
1732
1732
|
case 500: {
|
1733
1733
|
console.log(response.status, response.statusText, config.url, response.data)
|
1734
|
-
if(response.data){
|
1734
|
+
if (response.data) {
|
1735
1735
|
return response
|
1736
1736
|
}
|
1737
1737
|
break
|
@@ -5790,7 +5790,7 @@ class SteamUser {
|
|
5790
5790
|
url: `${this._myProfile}/tradeoffers/`,
|
5791
5791
|
method: 'GET',
|
5792
5792
|
})
|
5793
|
-
if(!result?.data){
|
5793
|
+
if (!result?.data) {
|
5794
5794
|
return
|
5795
5795
|
}
|
5796
5796
|
const $ = result._$()
|
@@ -6113,6 +6113,53 @@ class SteamUser {
|
|
6113
6113
|
return {list, assets, success: true}
|
6114
6114
|
}
|
6115
6115
|
}
|
6116
|
+
|
6117
|
+
async getPlayerReports(token) {
|
6118
|
+
const param = {
|
6119
|
+
sessionid: this._sessionid,
|
6120
|
+
tab: "playerreports",
|
6121
|
+
ajax: 1,
|
6122
|
+
...(!!token && {continue_token: token})
|
6123
|
+
}
|
6124
|
+
const data = (await this._httpRequestAjax({
|
6125
|
+
url: `my/gcpd/730?${Object.keys(param).map(k => `${k}=${param[k]}`).join('&')}`,
|
6126
|
+
}))?.data
|
6127
|
+
if (data.success !== true) {
|
6128
|
+
return
|
6129
|
+
}
|
6130
|
+
const {
|
6131
|
+
success,
|
6132
|
+
html,
|
6133
|
+
continue_token,
|
6134
|
+
continue_text
|
6135
|
+
} = data
|
6136
|
+
const $ = cheerio.load(StringUtils.cleanSpace(html))
|
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,
|
6159
|
+
})
|
6160
|
+
})
|
6161
|
+
return reports;
|
6162
|
+
}
|
6116
6163
|
}
|
6117
6164
|
|
6118
6165
|
function querySelectorAll($, selector, root) {
|