JimmyLaurent / cloudflare-scraper

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

It's possible to edit User Agent ? #26

Closed MathieuGery closed 3 years ago

MathieuGery commented 3 years ago

It's possible to edit User Agent ?

RamBoFe commented 3 years ago

For now, you can edit User Agent in utils.js file from line 1 to 6 :

const USER_AGENT_MAC =
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36';
const USER_AGENT_WINDOWS =
  'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36';
const USER_AGENT_LINUX =
  'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36';

This should probably be made configurable in the future.

RamBoFe commented 3 years ago

I bring a precision to my previous message. Another way to set up your own User Agent is to use this code found here.

This approach avoids touching the source code of the package and is more configurable.

MathieuGery commented 3 years ago

Nice this sounds really good I will try !