Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

[Typescript] Type Cloudscraper does not satisfy the constraint Request #273

Closed
roblav96 opened this issue Oct 3, 2019 · 6 comments
Closed

Comments

@roblav96
Copy link

roblav96 commented Oct 3, 2019

On latest cloudscraper@4.3.0

$ tsc --noEmit --noErrorTruncation
node_modules/cloudscraper/index.d.ts:78:56 - error TS2344: Type 'Cloudscraper' does not satisfy the constraint 'Request'.
  Type 'Cloudscraper' is missing the following properties from type 'Request': readable, writable, debug, pipeDest, and 48 more.

78   interface CloudscraperAPI extends request.RequestAPI<Cloudscraper, CoreOptions, request.RequiredUriUrl> {
                                                          ~~~~~~~~~~~~
Found 1 error.

I got the number of missing properties down to 24 by uniting Cloudscraper & http.OutgoingMessage

interface CloudscraperAPI extends request.RequestAPI<Cloudscraper & http.OutgoingMessage, CoreOptions, request.RequiredUriUrl> {
  defaultParams: DefaultOptions;
}
➤ tsc --noEmit --noErrorTruncation
node_modules/cloudscraper/index.d.ts:78:56 - error TS2344: Type 'Cloudscraper & OutgoingMessage' does not satisfy the constraint 'Request'.
  Type 'Cloudscraper & OutgoingMessage' is missing the following properties from type 'Request': readable, debug, pipeDest, qs, and 24 more.

78   interface CloudscraperAPI extends request.RequestAPI<Cloudscraper & http.OutgoingMessage, CoreOptions, request.RequiredUriUrl> {
                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error.
@Zirpoo
Copy link

Zirpoo commented Nov 9, 2019

TSLint issue solved by doing this:

interface CloudscraperAPI extends request.RequestAPI<Cloudscraper & request.ResponseRequest, request.CoreOptions, request.RequiredUriUrl> { defaultParams: DefaultOptions; }

@alecs1988
Copy link

yo someone can help me i have a discord bot and when i try to open it i'm received this error

at Request.<anonymous> (/node_modules/request/request.js:1161:10) at Request.emit (events.js:210:5) at Gunzip.<anonymous> (/node_modules/request/request.js:1083:12) at Object.onceWrapper (events.js:299:28) at Gunzip.emit (events.js:215:7) at endReadableNT (_stream_readable.js:1184:12) at processTicksAndRejections (internal/process/task_queues.js:80:21) { name: 'CaptchaError', message: 'captcha' }

@codemanki
Copy link
Owner

@alecs1988 please read through the docs. The error you are getting is because cloudflare is returning a captcha for your request, cloudscraper can't solve it for you, but you can always use some 3rd party service to solve this captcha and submit an answer back to the page you are trying to fetch.

@alecs1988
Copy link

but it worked perfectly but now no, and as i see the discord page does not use captcha, how could i fix this error? using a 2captcha service?

@codemanki
Copy link
Owner

@alecs1988 it might be that your Ip address was blacklisted because of the number of requests you are making. I would use first try to different user agent, if that wont help, then most probably 2captcha or similar service would be your only solution

@andress134
Copy link

@codemanki yo bro i have same problem, check discord when u can

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants