Prince25 / StockAlertBot

Faced with the scenario of scalpers using bots to hog up all the inventory of popular holiday toys and sell them at ridiculously high markup prices, I decided to put up a fight so we can get our hands on things we need to survive the #Coronavirus quarantine(s).
https://github.com/PrinceS25/StockAlertBot/wiki/Beating-Scalpers
MIT License
231 stars 44 forks source link

Newegg proxy #67

Closed andtecks closed 3 years ago

andtecks commented 3 years ago

I hope this is right. Everything is working fine but I was trying to use a (good)proxy and its giving me this error. Without proxy it's working fine.

Error [ERR_SOCKET_CLOSED]: Socket is closed at new NodeError (node:internal/errors:329:5) at Socket._writeGeneric (node:net:763:8) at Socket._write (node:net:785:8) at doWrite (node:internal/streams/writable:414:12) at clearBuffer (node:internal/streams/writable:573:7) at Socket.Writable.uncork (node:internal/streams/writable:354:7) at ClientRequest._flushOutput (node:_http_outgoing:949:10) at ClientRequest._flush (node:_http_outgoing:918:22) at onSocketNT (node:_http_client:835:9) at processTicksAndRejections (node:internal/process/task_queues:82:21) { code: 'ERR_SOCKET_CLOSED', config: { url: 'https://www.newegg.com/asus-geforce-rtx-3070-tuf-rtx3070-o8g-gaming/p/N82E16814126461', method: 'get', headers: { Accept: 'application/json, text/plain, /', 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2919.83 Safari/537.36' }, transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, adapter: [Function: httpAdapter], xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, httpsAgent: HttpsProxyAgent { _events: [Object: null prototype] {}, _eventsCount: 0, _maxListeners: undefined, timeout: null, maxFreeSockets: 1, maxSockets: 1, maxTotalSockets: Infinity, sockets: {}, freeSockets: {}, requests: {}, options: {}, secureProxy: false, proxy: [Object], promisifiedCallback: [Function: callback],

},
validateStatus: [Function: validateStatus],
data: undefined

}, request: <ref *1> Writable { _writableState: WritableState { objectMode: false, highWaterMark: 16384, finalCalled: false, needDrain: false, ending: false, ended: false, finished: false, destroyed: false, decodeStrings: true, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: true, bufferProcessing: false, onwrite: [Function: bound onwrite], writecb: null, writelen: 0, afterWriteTickInfo: null, buffered: [], bufferedIndex: 0, allBuffers: true, allNoop: true, pendingcb: 0, constructed: true, prefinished: false, errorEmitted: false, emitClose: true, autoDestroy: true, errored: null, closed: false, closeEmitted: false,

},
_events: [Object: null prototype] {
  response: [Function: handleResponse],
  error: [Function: handleRequestError]
},
_eventsCount: 2,
_maxListeners: undefined,
_options: {
  maxRedirects: 21,
  maxBodyLength: 10485760,
  protocol: 'https:',
  path: '/asus-geforce-rtx-3070-tuf-rtx3070-o8g-gaming/p/N82E16814126461',
  method: 'GET',
  headers: [Object],
  agent: [HttpsProxyAgent],
  agents: [Object],
  auth: undefined,
  hostname: 'www.newegg.com',
  port: null,
  nativeProtocols: [Object],
  pathname: '/asus-geforce-rtx-3070-tuf-rtx3070-o8g-gaming/p/N82E16814126461'
},
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_onNativeResponse: [Function (anonymous)],
_currentRequest: ClientRequest {
  _events: [Object: null prototype],
  _eventsCount: 7,
  _maxListeners: undefined,
  outputData: [],
  outputSize: 0,
  writable: true,
  destroyed: true,
  _last: true,
  chunkedEncoding: false,
  shouldKeepAlive: false,
  _defaultKeepAlive: true,
  useChunkedEncodingByDefault: false,
  sendDate: false,
  _removedConnection: false,
  _removedContLen: false,
  _removedTE: false,
  _contentLength: 0,
  _hasBody: true,
  _trailer: '',
  finished: true,
  _headerSent: true,
  _closed: true,
  socket: [Socket],
  _header: 'GET /asus-geforce-rtx-3070-tuf-rtx3070-o8g-gaming/p/N82E16814126461 HTTP/1.1\r\n' +
    'Accept: application/json, text/plain, */*\r\n' +
    'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2919.83 Safari/537.36\r\n' +
    'Host: www.newegg.com\r\n' +
    'Connection: close\r\n' +
    '\r\n',
  _keepAliveTimeout: 0,
  _onPendingData: {},
  agent: [HttpsProxyAgent],
  socketPath: undefined,
  method: 'GET',
  maxHeaderSize: undefined,
  insecureHTTPParser: undefined,
  path: '/asus-geforce-rtx-3070-tuf-rtx3070-o8g-gaming/p/N82E16814126461',
  _ended: true,
  res: [IncomingMessage],
  aborted: false,
  timeoutCb: null,
  upgradeOrConnect: false,
  parser: null,
  maxHeadersCount: null,
  reusedSocket: false,
  host: 'www.newegg.com',
  protocol: 'https:',
  _redirectable: [Circular *1],
  [Symbol(kCapture)]: false,
  [Symbol(kNeedDrain)]: false,
  [Symbol(corked)]: 0,
  [Symbol(kOutHeaders)]: [Object: null prototype]
},
_currentUrl: 'https://www.newegg.com/asus-geforce-rtx-3070-tuf-rtx3070-o8g-gaming/p/N82E16814126461',
[Symbol(kCapture)]: false

}, response: undefined, isAxiosError: true, toJSON: [Function: toJSON] }

Prince25 commented 3 years ago

Hi, in what format is your proxy? Make sure it's a HTTP proxy and not a SOCKS proxy. Also using just one proxy is not always the best because of how hit and miss they are. Trying at least 5-10 proxies if possible and see if at least one works. Socket is closed error just means the proxy server closed the connection for whatever reason.

andtecks commented 3 years ago

I paid for the proxies on the website you linked. We share or somethin. I had about 8 proxies in my list and they were "ip:port" I try a couple different things when I get home and then get back to you. Tyvm

Prince25 commented 3 years ago

If you're using the ip:port format, then make sure your IP is authorized on the website. Otherwise, use username:password@ip:port format. Let me know 😃

andtecks commented 3 years ago

I really appreciate the help. username:password@ip:port fixed the problem for me. Ty!

Prince25 commented 3 years ago

Glad to hear it! Please consider donating and sharing the project. Best of luck to you.