IntriguingTiles / cleverbot-free

Simple package to interact with the same API that the Cleverbot website uses for free.
MIT License
37 stars 10 forks source link

Error: Service Unavailable #23

Closed CoderViki closed 3 years ago

CoderViki commented 3 years ago

"Service Unavailable" error with long cleverbot-free usage I have a Discord Bot, and because of its high usage, an error like this comes up at the end. I tried to fix it, I've been working for 5 hours. I examined the codes of Cleverbot.com and discovered that it is related to the "XVIS" cookie. How can I fix this? Thanks.

Error: Service Unavailable at Request.callback (C:\Users\lenovo\Desktop\Testing\node_modules\superagent\lib\node\index.js:883:15) at IncomingMessage. (C:\Users\lenovo\Desktop\Testing\node_modules\superagent\lib\node\index.js:1126:20) at IncomingMessage.emit (events.js:327:22) at endReadableNT (_stream_readable.js:1327:12) at processTicksAndRejections (internal/process/task_queues.js:80:21) { status: 503, response: <ref *1> Response { _events: [Object: null prototype] {}, _eventsCount: 0, _maxListeners: undefined, res: IncomingMessage { _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 4, _maxListeners: undefined, socket: [TLSSocket], httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, headers: [Object], rawHeaders: [Array], trailers: {}, rawTrailers: [], aborted: false, upgrade: false, url: '', method: null, statusCode: 503, statusMessage: 'Service Temporarily Unavailable', client: [TLSSocket], _consuming: false, _dumped: false, req: [ClientRequest], text: '\r\n' + '503 Service Temporarily Unavailable\r\n' + '\r\n' + '

503 Service Temporarily Unavailable

\r\n' + '
nginx/1.14.0
\r\n' + '\r\n' + '\r\n' + '\r\n' + '\r\n' + '\r\n' + '\r\n' + '\r\n' + '\r\n',

  [Symbol(RequestTimeout)]: undefined
},
request: Request {
  _events: [Object: null prototype],
  _eventsCount: 1,
  _maxListeners: undefined,
  _enableHttp2: false,
  _agent: false,
  _formData: null,
  method: 'POST',
  url: 'https://www.cleverbot.com/webservicemin?uc=UseOfficialCleverbotAPI',
  _header: [Object],
  header: [Object],
  writable: true,
  _redirects: 0,
  _maxRedirects: 5,
  cookies: '',
  qs: {},
  _query: [],
  qsRaw: [],
  _redirectList: [],
  _streamRequest: false,
  _data: 'stimulus=Hello&cb_settings_scripting=no&islearning=1&icognoid=wsf&icognocheck=794b591c123983cffd89b144241d7ea2',
  req: [ClientRequest],
  protocol: 'https:',
  host: 'www.cleverbot.com',
  _endCalled: true,
  _callback: [Function (anonymous)],
  _fullfilledPromise: [Promise],
  res: [IncomingMessage],
  _resBuffered: true,
  response: [Circular *1],
  called: true,
  [Symbol(kCapture)]: false
},
req: ClientRequest {
  _events: [Object: null prototype],
  _eventsCount: 3,
  _maxListeners: undefined,
  outputData: [],
  outputSize: 0,
  writable: true,
  destroyed: false,
  _last: true,
  chunkedEncoding: false,
  shouldKeepAlive: false,
  _defaultKeepAlive: true,
  useChunkedEncodingByDefault: true,
  sendDate: false,
  _removedConnection: false,
  _removedContLen: false,
  _removedTE: false,
  _contentLength: 110,
  _hasBody: true,
  _trailer: '',
  finished: true,
  _headerSent: true,
  socket: [TLSSocket],
  _header: 'POST /webservicemin?uc=UseOfficialCleverbotAPI HTTP/1.1\r\n' +
    'Host: www.cleverbot.com\r\n' +
    'Accept-Encoding: gzip, deflate\r\n' +
    'Cookie: XVIS=TE1939AFFIAGAYQZA6710;Path=/;Max-Age=5000\r\n' +
    'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36\r\n' +
    'Content-Type: text/plain\r\n' +
    'Content-Length: 110\r\n' +
    'Connection: close\r\n' +
    '\r\n',
  _keepAliveTimeout: 0,
  _onPendingData: [Function: noopPendingOutput],
  agent: [Agent],
  socketPath: undefined,
  method: 'POST',
  maxHeaderSize: undefined,
  insecureHTTPParser: undefined,
  path: '/webservicemin?uc=UseOfficialCleverbotAPI',
  _ended: true,
  res: [IncomingMessage],
  aborted: false,
  timeoutCb: null,
  upgradeOrConnect: false,
  parser: null,
  maxHeadersCount: null,
  reusedSocket: false,
  host: 'www.cleverbot.com',
  protocol: 'https:',
  [Symbol(kCapture)]: false,
  [Symbol(kNeedDrain)]: false,
  [Symbol(corked)]: 0,
  [Symbol(kOutHeaders)]: [Object: null prototype]
},
text: '<html>\r\n' +
  '<head><title>503 Service Temporarily Unavailable</title></head>\r\n' +
  '<body bgcolor="white">\r\n' +
  '<center><h1>503 Service Temporarily Unavailable</h1></center>\r\n' +
  '<hr><center>nginx/1.14.0</center>\r\n' +
  '</body>\r\n' +
  '</html>\r\n' +
  '<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n' +
  '<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n' +
  '<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n' +
  '<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n' +
  '<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n' +
  '<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n',
body: {},
files: undefined,
buffered: true,
headers: {
  server: 'nginx/1.14.0',
  date: 'Thu, 22 Apr 2021 18:51:34 GMT',
  'content-type': 'text/html',
  'content-length': '615',
  connection: 'close'
},
header: {
  server: 'nginx/1.14.0',
  date: 'Thu, 22 Apr 2021 18:51:34 GMT',
  'content-type': 'text/html',
  'content-length': '615',
  connection: 'close'
},
statusCode: 503,
status: 503,
statusType: 5,
info: false,
ok: false,
redirect: false,
clientError: false,
serverError: true,
error: Error: cannot POST /webservicemin?uc=UseOfficialCleverbotAPI (503)
    at Response.toError (C:\Users\lenovo\Desktop\Testing\node_modules\superagent\lib\node\response.js:98:13)
    at ResponseBase._setStatusProperties (C:\Users\lenovo\Desktop\Testing\node_modules\superagent\lib\response-base.js:119:48)
    at new Response (C:\Users\lenovo\Desktop\Testing\node_modules\superagent\lib\node\response.js:44:8)
    at Request._emitResponse (C:\Users\lenovo\Desktop\Testing\node_modules\superagent\lib\node\index.js:930:18)
    at IncomingMessage.<anonymous> (C:\Users\lenovo\Desktop\Testing\node_modules\superagent\lib\node\index.js:1126:42)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  status: 503,
  text: '<html>\r\n' +
    '<head><title>503 Service Temporarily Unavailable</title></head>\r\n' +
    '<body bgcolor="white">\r\n' +
    '<center><h1>503 Service Temporarily Unavailable</h1></center>\r\n' +
    '<hr><center>nginx/1.14.0</center>\r\n' +
    '</body>\r\n' +
    '</html>\r\n' +
    '<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n' +
    '<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n' +
    '<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n' +
    '<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n' +
    '<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n' +
    '<!-- a padding to disable MSIE and Chrome friendly error page -->\r\n',
  method: 'POST',
  path: '/webservicemin?uc=UseOfficialCleverbotAPI'
},
created: false,
accepted: false,
noContent: false,
badRequest: false,
unauthorized: false,
notAcceptable: false,
forbidden: false,
notFound: false,
unprocessableEntity: false,
type: 'text/html',
links: {},
setEncoding: [Function: bound ],
redirects: [],
pipe: [Function (anonymous)],
[Symbol(kCapture)]: false

} }:

lpdavidgc commented 3 years ago

Same issue here... 🤪

IntriguingTiles commented 3 years ago

I've pushed a fix to npm which hopefully avoids the 503.

CoderViki commented 3 years ago

Thanks! I love you man.