Jump to content
McKay Development

What Comes Around

Member
  • Posts

    76
  • Joined

  • Last visited

Everything posted by What Comes Around

  1. Good day, I have bots that are scraping the CSGO market for new items and their prices. I have around 42 bot accounts doing this, every 5 bots have their own proxy ip. I assign the ip to the steam client. However, my actual ip is getting rate limited even though I don't use it much, so I guess the requests are going through the proxy. Here is the code with which I assign a proxy: let Client = { client: new SteamUser({ httpProxy: proxy, webCompatibilityMode: true }), community: new SteamCommunity(), manager: new TradeOfferManager({ steam: this.client, community: this.community, language: 'en' }) } Am I not using this correctly? How can I narrow down the issue? I am 100% sure it's because of my bots running, because when I turn them off and wait for a little while, my ip is no longer rate limited.
  2. 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.
  3. Thanks! I appreciate the help Edit: I got everything figured out
  4. 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?
  5. Good news, well I mean the error still occurs but I know what's going on. And knowing is good . As you can see, while the error did look scary being displayed 5-10 times, all accounts do get successful requests from time to time. In fact, more often than not. So the fear factor was just a result of the scale I'm working in. I am not sure why this is the error I get instead of 502, but whatever, it's not catastrophic. Problem solved.
  6. I have looked at several ways I thought I could prevent this error, but I am still getting it. I cannot understand why it is happening. I have even made the client weblog() when the error occurs more than 10 times in succession. Still doesn't fix it. Do you know what this error could be? Because I cannot understand what the cause is.
  7. Oh I see, what happens in that case? Is there a similar property I could use for steamcommunity?
  8. Yes, I have a listener for the event and I check the steamID property. So the sessionExpired event gets handled, I don't understand why I am getting the error in that case. Here is my listener: community.on('sessionExpired', () => { information.steam_webservice_connection = 'disconnected'; log.info('LoginClient', `${user.username}'s websession expired!`) if (client.steamID == null) { log.info('LoginClient', `${user.username} was disconnected from steam! Relogging in.`) } else { client.webLogOn(); } }) So in this way if the websession is expired I log in again, otherwise it does nothing because I have relogging in enabled as default. Also I have a bit of code that checks the steam community steamID and steam client steamID to check if the user is connected: if (SteamClients[user].client.steamID == null || SteamClients[user].community.steamID == null) { connection = '\x1b[31mdisconnected\x1b[37m' } else { connection = '\x1b[32mconnected\x1b[37m' } and so far it seems the clients and webclients are always connected, unless steam is down. And keep in mind, as I am seeing all accounts connected, I am getting this error. So I thought it must be a cookies issue, that's why manager doesn't have access to the inventory, but then I have this listener: client.on('webSession', (sid, cookies) => { information.steam_webservice_connection = 'connected'; manager.setCookies(cookies); community.setCookies(cookies); hasWebSession = true; log.debug('LoginClient', `Client weblogged in ${user.username}`) if(isLoggedOn) { stratup = true; information.start_time = Date.now(); resolve() }; }) So if the client makes a new session (and it negotiates a websession) this event should fire. And if a new websession is established from the session expiration listener, this should fire. So, in any case manager's cookies should be up to date. So I really don't understand why I am getting this error. One more thing I should probably mention is these are my options for the manager constructor: manager: new TradeOfferManager({ steam: this.client, community: this.community, language: 'en' }) Would this perhaps need to be updated if a new client session/websession is established? I don't see why it should as the client and community constructors don't change, their sessions do but not the constructor themselves. But I just thought I should throw this out there.
  9. Good day! Recently I was surprised to find that my bots had inventories but looking at the logs they said they didn't have anything. So after enabling output settings I got to see the error. I am getting this error: Of course the Error in getting inventory part is my own. Here is my code for getting the inventory: function GetInventory(user){ return new Promise((resolve, reject) => { const { client, community, manager, details: { username, password, shared_secret, }, } = SteamClients[user.username]; manager.getInventoryContents(730, 2, false, (err, inventory) => { if (err) { log.debug('GetInventory', err) reject(err); } else { resolve(inventory); } }) }) } I am confused as to why this happens after some time of my bots running. I considered that maybe when the sessions expire the cookies for manager don't get reassigned, but they do. I webRelog when the websession expires, I have relog enabled (as default) and I have all the appropriate event listeners and manager's cookies are set on a new websession being established. So I don't understand why this is happening. Any ideas?
  10. Also, are the events 'loggedOn' and 'disconnected' directly tied to the state of client.steamID? Also, is client.steamID an accurate indicator of the client being connected? If I had to guess, client.steamID is returned by steam and is nullified when the connection is broken, and when the ID is returned (Client is connected) or there is a disconnection those events are emitted. Is my assumption correct?
  11. That's strange. Because based on my code I don't see how this should occur. Below I will include the only code that should relogin the user. community.on('sessionExpired', () => { log.info('LoginClient', `${user.username}'s websession expired!`) if (client.steamID == null) { log.info('LoginClient', `${user.username} was disconnected from steam! Relogging in.`) client.logOn({ accountName: username, password: password, rememberPassword: true, twoFactorCode: SteamTotp.generateAuthCode(shared_secret), }); } else { client.webLogOn(); } }) Let me know if you see anything wrong with this. Because unless client.steamID doesn't always return the correct login status, I don't see why this error should occur. Also, I should mention that before the code above was introduced, I wasn't getting the "already logged in" error. Edit: Thinking about it now, perhaps the issue is that when I log in via client.logOn I replace the session, and because I have relog turned on, it relogs in, causing this loop. Because I am getting 1000s of relogins and the Replaced Session error pops up as well. So if I had to guess that's the cause, and the fix would be to just not call logOn, let it do it's thing but once client.steamID is ! null,call client.webLogOn(). Anyways, that's just me guessing. I'd like to hear your thoughts on what's happening.
  12. I get this error from time to time: (node:31740) UnhandledPromiseRejectionWarning: Error: Already logged on, cannot log on again at C:\Users\Ernest\Desktop\Current Version\node_modules\steam-user\components\logon.js:23:10 at processTicksAndRejections (internal/process/task_queues.js:75:11) (node:31740) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3) Sometimes my bot experiences this error maybe times in a row. Worst case scenario I've seen it reoccur 100 times. Any idea what could be the cause of this issue? I found this while looking at the steam user npm: https://www.npmjs.com/package/steam-user#events-. At steamGuard I can see that you mention: "If you are using 2FA, you need to check the lastCodeWrong argument. If it's true, then the last code you provided was incorrect (likely already used). In this case, you should wait 30 seconds to allow the TOTP algorithm to generate a new code. Failure to do so will result in a login loop, causing your IP address to be temporarily banned.". Could this be the cause of the error?
  13. Perfect! Thank you! Also if I use the logOn() function, by default the webLogOn function is called too, right?
  14. C:\Users\Ernest\Desktop\SteamBot\node_modules\steam-user\components\web.js:10 throw new Error("Cannot log onto steamcommunity.com without first being connected to Steam network"); ^ Error: Cannot log onto steamcommunity.com without first being connected to Steam network at SteamUser.webLogOn (C:\Users\Ernest\Desktop\SteamBot\node_modules\steam-user\components\web.js:10:9) at SteamCommunity.<anonymous> (C:\Users\Ernest\Desktop\SteamBot\components\steamclient.js:73:20) at SteamCommunity.emit (events.js:315:20) at SteamCommunity._notifySessionExpired (C:\Users\Ernest\Desktop\SteamBot\node_modules\steamcommunity\components\http.js:85:7) at C:\Users\Ernest\Desktop\SteamBot\node_modules\steamcommunity\components\confirmations.js:21:10 at C:\Users\Ernest\Desktop\SteamBot\node_modules\steamcommunity\components\confirmations.js:272:4 at SteamCommunity._checkHttpError (C:\Users\Ernest\Desktop\SteamBot\node_modules\steamcommunity\components\http.js:90:3) at Request._callback (C:\Users\Ernest\Desktop\SteamBot\node_modules\steamcommunity\components\http.js:50:61) at self.callback (C:\Users\Ernest\Desktop\SteamBot\node_modules\request\request.js:185:22) at Request.emit (events.js:315:20) Function that triggers it: client.logOn({ accountName: username, password: password, rememberPassword: true, twoFactorCode: SteamTotp.generateAuthCode(shared_secret), }); client.on('loggedOn', ()=> { isLoggedOn = true; client.setPersona(1); log.debug('LoginClient', `Client logged in ${user.username}`) if(hasWebSession) resolve(); }) client.on('webSession', (sid, cookies) => { manager.setCookies(cookies); community.setCookies(cookies); hasWebSession = true; log.debug('LoginClient', `Client weblogged in ${user.username}`) if(isLoggedOn) resolve(); }) client.on('error', (err) => { log.error('LoginClient', `Client experienced an error ${user.username}`) log.error('LoginClient', err) }) community.on('sessionExpired', () => { log.info('LoginClient', `${user.username}'s websession expired!`) client.webLogOn(); }) community.on('sessionExpired', () => { log.info('LoginClient', `${user.username}'s websession expired!`) client.webLogOn(); }) Here is an error I am getting when checking for an expired session. Would it be possible to prevent this? I mean I think I could do something along the lines of try catching weblogOn, but do you perhaps have a better solution?
  15. Sorry for the late reply. I normally read a file, reads and splits the string (read from file) into an array of proxy objects, one of the properties is the number of clients. If the number of clients is more than lets say 10, take a different proxy and increase the client number for that proxy. Something like that.
  16. Good day! I get this error from time to time: ConfirmationChecker Error: Not Logged In at Request.init (D:\Node Projects\SteamMarketBot\node_modules\request\request.js:458:31) at Redirect.onResponse (D:\Node Projects\SteamMarketBot\node_modules\request\lib\redirect.js:149:11) at Request.onRequestResponse (D:\Node Projects\SteamMarketBot\node_modules\request\request.js:986:22) at ClientRequest.emit (events.js:315:20) at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:641:27) at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17) at HTTPParser.execute (<anonymous>) at TLSSocket.socketOnData (_http_client.js:509:22) at TLSSocket.emit (events.js:315:20) at addChunk (internal/streams/readable.js:309:12) What is strange is that the client is still connected in most cases. It still returns inventories, it still changes gamesPlayed but when accepting all confirmations, it gives me this error. So I am curious what I can do to fix the error.
  17. What I do is put a proxy list in a predetermined folder, my code then reads and splits the string (read from file) into an array of proxies. Then it assigns each proxy to a maximum of 10 steam clients.
  18. Thanks for clarifying, guess it applies to all kinds of botting activity
  19. OOPS, that makes sense, because I have already set cookies for community. It is now working. Thank you very much! I would also like to ask if using this extensively could be a ban-able offence on steam? And thanks again for your help, really appreciate it! I also really appreciate all of your work in general!
  20. Thanks! Here is what I have right now: const SteamUser = require('steam-user'); const SteamTotp = require('steam-totp'); const config = require('./config'); const SteamCommunity = require('steamcommunity'); const TradeOfferManager = require('steam-tradeoffer-manager'); const client = new SteamUser(); const community = new SteamCommunity(); const manager = new TradeOfferManager({ steam: client, community: community, language: 'en' }) const loginOptions = { accountName: config.username, password: config.password, twoFactorCode: SteamTotp.generateAuthCode(config.shared_secret) } client.logOn(loginOptions); client.on('loggedOn', () => { console.log('logged on'); client.setPersona(1); }); client.on('webSession', async (sid, cookies) => { manager.setCookies(cookies); community.setCookies(cookies); let item = await getItem() var requestoptions = { form: { sessionid: community.getSessionID(), appid: item.appid, assetid: item.assetid, contextid: item.contextid, amount: 1, price: 10 }, headers: { 'Origin': 'https://steamcommunity.com', 'Referer': 'https://steamcommunity.com/my/inventory/', 'Cookie': cookies, 'Host': 'steamcommunity.com', }, json: true } console.log(requestoptions) community.httpRequestPost('https://steamcommunity.com/market/sellitem/', requestoptions, (err, response, json) => { if (err) { console.log(err.toString()); return; } // console.log(json) console.log(response) }, "steamcommunity") }) const getItem = () => { return new Promise((resolve, reject) => { manager.getInventoryContents(730, 2, true, (err, inventory) => { if (err) { reject(err); } else { resolve(inventory[0]); } }) }) } I've added the assetid because I found that steam uses that on their website for market sell requests. The headers that are set by HTTP protocol have been removed. I am still getting the 400 error. I am thinking I should maybe use the steam client in a sandbox and api call log to find out exactly what I am missing. Or at least I would be able to slowly remove unnecessary fields until I have something basic I can use without getting 400 statuses. So far I have gotten sell orders working on chrome using puppeteer and just using cors mode, but getting inventory information and other account details with puppeteer would be a real hassle when as great of a library as yours exists. So this is where I am, I will try to get api logging working and hopefully find out what I am missing. Or of course if you see any mistakes please let me know.
  21. Sorry, the redirect was the result of me trying http not https, however steam redirects http requests to https. Had nothing to do with curly braces. Also I read from a similar thread : https://dev.doctormckay.com/topic/1495-automatically-selling-steam-items-error-400/?tab=comments#elControls_4826:~:text=When you're doing things on the,any of those other headers either. that the headers shouldn't be entered manually. Is there a way for me to extract that data from the client by any chance?
  22. Oops, my bad. It was old code that I copy pasted. I stopped using confirmation checker Also, still getting 400, what could I be doing wrong? Could it be the user agent? I've also tried sending the request to the http address instead, but I got either Malformed Request (without curly braces around requestoptions) or a redirect (with curly braces around requestoptions).
×
×
  • Create New...