What Comes Around Posted August 19, 2021 Report Posted August 19, 2021 Good day, I have been trying to make a function that searches for a random item on the steam market, I ran into an issue. Here is the error: C:\Users\Ernest\Desktop\SteamBot\Current Version\node_modules\steamcommunity\classes\CMarketSearchResult.js:62 callback(new Error($errorMsg.text())); ^ TypeError: callback is not a function at SteamCommunity.<anonymous> (C:\Users\Ernest\Desktop\SteamBot\Current Version\node_modules\steamcommunity\classes\CMarketSearchResult.js:62:5) at Request._callback (C:\Users\Ernest\Desktop\SteamBot\Current Version\node_modules\steamcommunity\components\http.js:67:15) at Request.self.callback (C:\Users\Ernest\Desktop\SteamBot\Current Version\node_modules\request\request.js:185:22) at Request.emit (events.js:315:20) at Request.<anonymous> (C:\Users\Ernest\Desktop\SteamBot\Current Version\node_modules\request\request.js:1154:10) at Request.emit (events.js:315:20) at Gunzip.<anonymous> (C:\Users\Ernest\Desktop\SteamBot\Current Version\node_modules\request\request.js:1076:12) at Object.onceWrapper (events.js:421:28) at Gunzip.emit (events.js:315:20) at endReadableNT (internal/streams/readable.js:1327:12) C:\Users\Ernest\Desktop\SteamBot\Current Version>pause Press any key to continue . . . Looking at the code here is what I see: function performSearch() { self.httpRequest({ "uri": "https://steamcommunity.com/market/search/render/", "qs": qs, "headers": { "referer": "https://steamcommunity.com/market/search" }, "json": true }, function(err, response, body) { if (err) { callback(err); return; } if(!body.success) { callback(new Error("Success is not true")); return; } if(!body.results_html) { callback(new Error("No results_html in response")); return; } var $ = Cheerio.load(body.results_html); var $errorMsg = $('.market_listing_table_message'); if($errorMsg.length > 0) { callback(new Error($errorMsg.text())); return; } var rows = $('.market_listing_row_link'); for(var i = 0; i < rows.length; i++) { results.push(new CMarketSearchResult($(rows))); } if(body.start + body.pagesize >= body.total_count) { callback(null, results); } else { qs.start += body.pagesize; performSearch(); } }, "steamcommunity"); } }; Here is my code: community.marketSearch(query, 730, false, function(err, items) { if (err) { console.log(err) } else { console.log(items) resolve(items); } }) }) I don't think there is anything wrong with my code, any ideas? Quote
Dr. McKay Posted August 20, 2021 Report Posted August 20, 2021 The mistake is in your code. marketSearch only takes two arguments, options and callback. Remove the 730 and false. Quote
What Comes Around Posted August 21, 2021 Author Report Posted August 21, 2021 (edited) 14 hours ago, Dr. McKay said: The mistake is in your code. marketSearch only takes two arguments, options and callback. Remove the 730 and false. Thanks! I appreciate the help Edit: I got everything figured out Edited August 21, 2021 by What Comes Around Quote
What Comes Around Posted August 22, 2021 Author Report Posted August 22, 2021 (edited) Is there a way to get all the items on the steam market for CSGO? I have tried omitting query string and using '' (so nothing), but got back some error. I think it was there are no items with that keyword or something. Edited August 22, 2021 by What Comes Around Quote
Dr. McKay Posted August 23, 2021 Report Posted August 23, 2021 marketSearch({appid: 730}, (err, results) => { ... }); What Comes Around 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.