steamutils 1.2.85 → 1.2.86
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/index.js +17 -20
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -5486,8 +5486,8 @@ class SteamUser {
|
|
|
5486
5486
|
if (!result) return
|
|
5487
5487
|
|
|
5488
5488
|
const descriptions = result.descriptions
|
|
5489
|
-
const
|
|
5490
|
-
|
|
5489
|
+
const html = result.html?.replaceAll(/[\t\n\r]/gi, '')?.trim() || ''
|
|
5490
|
+
const $ = cheerio.load(html)
|
|
5491
5491
|
|
|
5492
5492
|
const tradehistory = []
|
|
5493
5493
|
$('.tradehistoryrow').each(function () {
|
|
@@ -5589,30 +5589,22 @@ class SteamUser {
|
|
|
5589
5589
|
const items_plusminus = tradehistory_items_el.find('.tradehistory_items_plusminus').text().trim()
|
|
5590
5590
|
tradehistory_items_el.find('.tradehistory_items_group > .history_item').each(function () {
|
|
5591
5591
|
const itemEl = $(this)
|
|
5592
|
-
const text = itemEl.text()
|
|
5592
|
+
const text = plainText(itemEl.text())//You did not receive any items in this trade.
|
|
5593
5593
|
const appID = itemEl.attr('data-appid')
|
|
5594
5594
|
const classid = itemEl.attr('data-classid')
|
|
5595
5595
|
const instanceid = itemEl.attr('data-instanceid')
|
|
5596
5596
|
const contextid = itemEl.attr('data-contextid')
|
|
5597
5597
|
|
|
5598
5598
|
if (text !== `You did not receive any items in this trade.`) {
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
contextid,
|
|
5609
|
-
steamId,
|
|
5610
|
-
plusminus: items_plusminus
|
|
5611
|
-
})
|
|
5612
|
-
}
|
|
5613
|
-
} else {
|
|
5614
|
-
// console.log("No app descriptions", appID);
|
|
5615
|
-
}
|
|
5599
|
+
tradehistory_items.push({
|
|
5600
|
+
appID,
|
|
5601
|
+
classid,
|
|
5602
|
+
instanceid,
|
|
5603
|
+
contextid,
|
|
5604
|
+
steamId,
|
|
5605
|
+
plusminus: items_plusminus,
|
|
5606
|
+
...(descriptions[appID]?.[classid + '_' + instanceid])
|
|
5607
|
+
})
|
|
5616
5608
|
}
|
|
5617
5609
|
})
|
|
5618
5610
|
})
|
|
@@ -5633,6 +5625,7 @@ class SteamUser {
|
|
|
5633
5625
|
...(!!tradePeople && {tradePeople})
|
|
5634
5626
|
})
|
|
5635
5627
|
} else {
|
|
5628
|
+
fs.writeFileSync('tradehistory_items_empty_' + steamId + "_" + new Date().getTime(), html)
|
|
5636
5629
|
console.error("tradehistory_items empty", steamId);
|
|
5637
5630
|
}
|
|
5638
5631
|
})
|
|
@@ -6103,4 +6096,8 @@ class SteamUser {
|
|
|
6103
6096
|
}
|
|
6104
6097
|
}
|
|
6105
6098
|
|
|
6099
|
+
function plainText(text) {
|
|
6100
|
+
return text?.replaceAll(/[\t\n\r]/gi, ' ')?.replaceAll(/\s+/g, ' ')?.trim()
|
|
6101
|
+
}
|
|
6102
|
+
|
|
6106
6103
|
export default SteamUser
|