steamutils 1.2.42 → 1.2.44
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +52 -0
- package/package.json +1 -1
package/index.js
CHANGED
@@ -6058,6 +6058,58 @@ class SteamUser {
|
|
6058
6058
|
"email_domain": "gmail.com"
|
6059
6059
|
}
|
6060
6060
|
}
|
6061
|
+
|
6062
|
+
async removeListing(id) {
|
6063
|
+
const response = (await this._httpRequestAjax({
|
6064
|
+
url: `market/removelisting/${id}`,
|
6065
|
+
method: "POST",
|
6066
|
+
data: {
|
6067
|
+
sessionid: this.getSessionid()
|
6068
|
+
},
|
6069
|
+
headers: {
|
6070
|
+
'content-type': 'application/x-www-form-urlencoded',
|
6071
|
+
Referer: 'https://steamcommunity.com/market/'
|
6072
|
+
},
|
6073
|
+
}))?.data
|
6074
|
+
return response
|
6075
|
+
}
|
6076
|
+
|
6077
|
+
async getMyListings() {
|
6078
|
+
const result = (await this._httpRequestAjax({
|
6079
|
+
url: `market/mylistings/render/?count=100`,
|
6080
|
+
}))?.data
|
6081
|
+
if (result?.success === true) {
|
6082
|
+
const $ = cherrio.load(result.results_html)
|
6083
|
+
const list = []
|
6084
|
+
$('.market_listing_row').each(function () {
|
6085
|
+
try {
|
6086
|
+
const $1 = $(this);
|
6087
|
+
const [sElementPrefix, listingid, appid, contextid, itemid] = $1.find('.market_listing_cancel_button > a').attr('href').split('(')[1].split(')')[0].split(',').map(r => r.trim().replaceAll(`'`, '').replaceAll(`"`, ''))
|
6088
|
+
const image = $1.find(`#mylisting_${listingid}_image`).attr('src')
|
6089
|
+
const buyer_pays_price = parseInt($1.find(`.market_listing_price span[title="This is the price the buyer pays."]`).text().replaceAll(`(`, '').replaceAll(`)`, '').replaceAll(`₫`, '').replaceAll(`.`, '').replaceAll(`,`, '').trim())
|
6090
|
+
const receive_price = parseInt($1.find(`.market_listing_price span[title="This is how much you will receive."]`).text().replaceAll(`(`, '').replaceAll(`)`, '').replaceAll(`₫`, '').replaceAll(`.`, '').replaceAll(`,`, '').trim())
|
6091
|
+
const item_name = $1.find('.market_listing_item_name_link').text()
|
6092
|
+
const game_name = $1.find('.market_listing_game_name').text()
|
6093
|
+
const date_combined = $1.find('.market_listing_listed_date_combined').text().replaceAll(`Listed:`,'').replaceAll(/[\t\n\r]/gi, ' ').replaceAll(/\s+/gi, ' ').trim()
|
6094
|
+
list.push({
|
6095
|
+
listingid,
|
6096
|
+
appid,
|
6097
|
+
contextid,
|
6098
|
+
itemid,
|
6099
|
+
buyer_pays_price,
|
6100
|
+
receive_price,
|
6101
|
+
item_name,
|
6102
|
+
game_name,
|
6103
|
+
date_combined,
|
6104
|
+
image,
|
6105
|
+
})
|
6106
|
+
} catch (e) {
|
6107
|
+
}
|
6108
|
+
})
|
6109
|
+
const assets = Object.values(result.assets["730"]["2"])
|
6110
|
+
return {list, assets, success: true}
|
6111
|
+
}
|
6112
|
+
}
|
6061
6113
|
}
|
6062
6114
|
|
6063
6115
|
export default SteamUser
|