steamutils 1.3.73 → 1.3.74
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +48 -31
- package/package.json +1 -1
package/index.js
CHANGED
@@ -6048,7 +6048,7 @@ export default class SteamUser {
|
|
6048
6048
|
}
|
6049
6049
|
}
|
6050
6050
|
|
6051
|
-
async getMyMarketHistory({ start = 0, count =
|
6051
|
+
async getMyMarketHistory({ start = 0, count = 100 } = {}) {
|
6052
6052
|
const result = await this._httpRequestAjax({
|
6053
6053
|
url: `market/myhistory/render/?query=&start=${start}&count=${count}`,
|
6054
6054
|
});
|
@@ -6057,40 +6057,57 @@ export default class SteamUser {
|
|
6057
6057
|
}
|
6058
6058
|
const data = result?.data;
|
6059
6059
|
if (data?.success === true) {
|
6060
|
-
const
|
6061
|
-
const
|
6062
|
-
|
6063
|
-
|
6064
|
-
|
6065
|
-
|
6066
|
-
if (!listingid) {
|
6060
|
+
const hovers = StringUtils.cleanSpace(data.hovers);
|
6061
|
+
const assetById = data.assets?.[730]?.[2] || {};
|
6062
|
+
const assestByListingId = {};
|
6063
|
+
hovers.split("CreateItemHoverFromContainer").forEach(function (text) {
|
6064
|
+
text = text.trim();
|
6065
|
+
if (!text.startsWith("(")) {
|
6067
6066
|
return;
|
6068
6067
|
}
|
6069
|
-
const
|
6070
|
-
const
|
6071
|
-
const
|
6072
|
-
|
6073
|
-
|
6074
|
-
|
6075
|
-
|
6076
|
-
|
6068
|
+
const texts = text.split(",");
|
6069
|
+
const listingId = texts[1]?.substringBetweenOrNull("history_row_", "_");
|
6070
|
+
const assestId = texts[4]?.trim()?.removeSurrounding("'");
|
6071
|
+
if (!listingId || !assestId || !assetById[assestId]) {
|
6072
|
+
return;
|
6073
|
+
}
|
6074
|
+
assestByListingId[listingId] = assestId;
|
6075
|
+
});
|
6077
6076
|
|
6078
|
-
|
6077
|
+
const $ = cheerio.load(data.results_html);
|
6078
|
+
const list = [...$(".market_listing_row")]
|
6079
|
+
.map(function (el) {
|
6080
|
+
el = $(el);
|
6081
|
+
const id = el.attr("id");
|
6082
|
+
const listingid = id.substringBetweenOrNull("history_row_", "_");
|
6083
|
+
if (!listingid) {
|
6084
|
+
return;
|
6085
|
+
}
|
6086
|
+
const gainOrLoss = StringUtils.cleanSpace(el.find(".market_listing_gainorloss").text());
|
6087
|
+
const image = el.find(`.market_listing_item_img`).attr("src");
|
6088
|
+
const price = parseInt(el.find(`.market_table_value .market_listing_price`).text().replaceAll(`(`, "").replaceAll(`)`, "").replaceAll(`₫`, "").replaceAll(`.`, "").replaceAll(`,`, "").trim()) || "";
|
6089
|
+
const item_name = el.find(".market_listing_item_name").text();
|
6090
|
+
const game_name = el.find(".market_listing_game_name").text();
|
6091
|
+
const listedOn = StringUtils.cleanSpace(el.find(".market_listing_listed_date + .market_listing_listed_date").text().replaceAll(`Listed:`, ""));
|
6092
|
+
const actedOn = StringUtils.cleanSpace(el.find(".market_listing_whoactedwith + .market_listing_listed_date").text().replaceAll(`Listed:`, ""));
|
6093
|
+
const status = StringUtils.cleanSpace(el.find(".market_listing_whoactedwith").text());
|
6079
6094
|
|
6080
|
-
|
6081
|
-
|
6082
|
-
|
6083
|
-
|
6084
|
-
|
6085
|
-
|
6086
|
-
|
6087
|
-
|
6088
|
-
|
6089
|
-
|
6090
|
-
|
6091
|
-
|
6092
|
-
|
6093
|
-
|
6095
|
+
return {
|
6096
|
+
id,
|
6097
|
+
listingid,
|
6098
|
+
price,
|
6099
|
+
item_name,
|
6100
|
+
game_name,
|
6101
|
+
listedOn,
|
6102
|
+
actedOn,
|
6103
|
+
image,
|
6104
|
+
gainOrLoss,
|
6105
|
+
status,
|
6106
|
+
...(!!assestByListingId[listingid] && { assetId: assestByListingId[listingid] }),
|
6107
|
+
};
|
6108
|
+
})
|
6109
|
+
.filter(Boolean);
|
6110
|
+
const assets = Object.values(assetById);
|
6094
6111
|
return { ...data, list, assets, success: true };
|
6095
6112
|
}
|
6096
6113
|
}
|