JimmyLaurent / cloudflare-scraper

A package to bypass Cloudflare's protection
MIT License
286 stars 30 forks source link

str.trim is not a function #19

Open kopax opened 3 years ago

kopax commented 3 years ago

Hi @JimmyLaurent and thanks for sharing,

I am trying const response = await cloudflareScraper.get('https://www.malt.fr'); in order to scrape my profile, and this is the error: str.trim is not a function

It seems this happen in tough-cookie@2.5.0

image

Can this be fixed ? Because it's actually the only client I have found that actually have bypassed the cloudflare security but this error makes it unusuable.

Thanks for reading.

coinproduct commented 3 years ago

I have the same error. Did you manage to fix it?

kopax commented 3 years ago

No i use some other library for this, cloudscraper

coinproduct commented 3 years ago

Can you use cloudscraper for puppeteer like this library?

coinproduct commented 3 years ago

I am actually getting this error when using that library: ### Cloudflare may have changed their technique, or there may be a bug.

arent you getting the same?

kopax commented 3 years ago

No it keeped working since I implemented it last week

Cosmysd commented 3 years ago

No it keeped working since I implemented it last week

You can share your cloudscraper fixed vers? https://github.com/bestplay9384/cloudscraper this vers has working since 2 month ago, now full patched

kopax commented 3 years ago

I've tested with @coinproduct and for some reason, the challenge was different and it was not passing. Perhaps coinproduct you could try with the version from bestplay9384 using my code sample?

RamBoFe commented 3 years ago

Hi,

I had got the same probleme and it seems fix with this following trick in fillCookiesJar.js at line 21 :

  return new Cookie({
    key: name,
    value,
    expires: expiresDate,
    domain: domain.startsWith('.') ? domain.substring(1) : domain,
    path
  }).toString();

Just add .toString() it's done.

Try this and tell me if this works for you.

danniel-isiah-libor commented 3 years ago

Bump to this issue