rastvl / cloudflare-cookies-generator

cf_clearance, rack.session, laravel_session, _bm etc... cloudflare cookies generator via headless browser
28 stars 8 forks source link

Timeout error #1

Closed AndresQuiVal closed 1 year ago

AndresQuiVal commented 2 years ago

Hello there, I execute the exact same sample code as the given in here and yet I have the following error:

{error: 'Failed to get cookies: timeout'}

Also changed the URL to other cloudflare page based, and exactly the same error, does this solution still works?? @rastvl

Thanks

rastvl commented 2 years ago

Hello there, I execute the exact same sample code as the given in here and yet I have the following error:

Hello @AndresQuiVal, cloudflare was updated a couple of days ago. I haven't checked the changes yet.

AndresQuiVal commented 2 years ago

Cool @rastvl , are you going to fix it? Thanks!

rastvl commented 2 years ago

Cool @rastvl , are you going to fix it? Thanks!

@AndresQuiVal There was a problem with the 2captcha extension code. Fixed. I also noticed that another browser test has been added to the cloudflare page. Instead of hcaptcha, sometimes you have to click on an item. I may have to deal with this later.

AndresQuiVal commented 2 years ago

Cool @rastvl , are you going to fix it? Thanks!

@AndresQuiVal There was a problem with the 2captcha extension code. Fixed. I also noticed that another browser test has been added to the cloudflare page. Instead of hcaptcha, sometimes you have to click on an item. I may have to deal with this later.

@rastvl Cool, seems that yet is not working, but we'll wait for the update of the package to be released!

rastvl commented 2 years ago

Cool, seems that yet is not working, but we'll wait for the update of the package to be released!

@AndresQuiVal At which site does the timeout occur? I checked on temp-mail.org and got valid cookies

AndresQuiVal commented 2 years ago

It happens in https://www.innvictus.com/

Get Outlook for iOShttps://aka.ms/o0ukef


From: rastvl @.> Sent: Tuesday, November 1, 2022 2:49:38 PM To: rastvl/cloudflare-cookies-generator @.> Cc: AndresQuiVal @.>; Mention @.> Subject: Re: [rastvl/cloudflare-cookies-generator] Timeout error (Issue #1)

Cool, seems that yet is not working, but we'll wait for the update of the package to be released!

@AndresQuiValhttps://github.com/AndresQuiVal At which site does the timeout occur? I checked on temp-mail.org and got valid cookies

— Reply to this email directly, view it on GitHubhttps://github.com/rastvl/cloudflare-cookies-generator/issues/1#issuecomment-1299126564, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMU3AQ5MOELGCCTZVCHLMUDWGF66FANCNFSM6AAAAAARUL55VM. You are receiving this because you were mentioned.Message ID: @.***>

rastvl commented 2 years ago

It happens in https://www.innvictus.com/

@AndresQuiVal I don't get cloudflare on this page. Most likely the problem is that the browser does not get the cloudflare challenge page too. You can see what happens in the browser by changing the headless property in the browserOptions object in constants.js file to false

AndresQuiVal commented 2 years ago

Cool i will try then, but also, i tried with the webpage that was used on the gfi attached to this issue, and yet didnt work, and also tried with medium.com which seems to use cloudflare; neither of them worked, is that normal??

Get Outlook for iOShttps://aka.ms/o0ukef


From: rastvl @.> Sent: Tuesday, November 1, 2022 3:01:36 PM To: rastvl/cloudflare-cookies-generator @.> Cc: AndresQuiVal @.>; Mention @.> Subject: Re: [rastvl/cloudflare-cookies-generator] Timeout error (Issue #1)

It happens in https://www.innvictus.com/

@AndresQuiValhttps://github.com/AndresQuiVal I don't get cloudflare on this page. Most likely the problem is that the browser does not get to the cloudflare challenge page too. You can see what happens in the browser by changing the headless property in the browserOptions object in constants.js file to false

— Reply to this email directly, view it on GitHubhttps://github.com/rastvl/cloudflare-cookies-generator/issues/1#issuecomment-1299152905, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMU3AQ45KDVPTVCKDP4KB2TWGGALBANCNFSM6AAAAAARUL55VM. You are receiving this because you were mentioned.Message ID: @.***>

rastvl commented 2 years ago

Cool i will try then, but also, i tried with the webpage that was used on the gfi attached to this issue, and yet didnt work, and also tried with medium.com which seems to use cloudflare; neither of them worked, is that normal??

@AndresQuiVal Much depends on your proxies. If the cloudflare challenge doesn't show up on your proxies, then you can work with the site without pre-installing the cookies, and you don't need this tool. I just tested on https://www.zoominfo.com/c/Central-Florida-Athletics/363146903, https://temp-mail.org/, https://www.dekudeals.com/login with "bad" ip where the cloudflare challenge triggered and it works fine. (Of course, I first installed the sitekey and rucaptcha api key in constants.js)

AndresQuiVal commented 2 years ago

@rastvl I tried with those urls: https://temp-mail.org/ https://www.dekudeals.com/login

but none of them worked, still giving timeout error; but for this url:https://www.zoominfo.com/c/Central-Florida-Athletics/363146903 it throw this error:

image

though was based on the captcha struggle the library has, yet don't know

Also, im not using proxies for all the sites im using the library with, so, still kind of trying to figure out why doesn't work :(

rastvl commented 2 years ago

I tried with those urls: https://temp-mail.org/ https://www.dekudeals.com/login

Have you enabled browser display in the constants.js file? I think that you from your ip just don't trigger the cloudflare challenge.

throw this error:

This happens because you have not set the values of hcaptcha_sitekey and capmonser_apikey variables in the constants.js file

AndresQuiVal commented 2 years ago

@rastvl Cool, let me try then, how can I enable browser display? the current content of the browserOptions const is like this:

const browserOptions = {
  ignoreHTTPSErrors: true,
  args: [
    '--lang=en-US,en;q=0.9',
    '--disable-sync',
    '--disable-features=IsolateOrigins,site-per-process',
  ],
  defaultViewport: {
    width: 1920,
    height: 1080,
  },
  headless: true //,
  // proxy: { server: 'per-context' }
};

NOTE that proxy is commented

rastvl commented 2 years ago

Cool, let me try then, how can I enable browser display?

headless: false

AndresQuiVal commented 2 years ago

@rastvl Still the same error after changing [that value](headless: false) I tried with both urls and neither of those worked, still timeout error {error: 'Failed to get cookies: timeout'}

rastvl commented 2 years ago

@AndresQuiVal Sorry, I'm not quite sure what you're doing. headless: false is so you can see if cloudflare triggers on your site. example

rastvl commented 2 years ago

@AndresQuiVal with hcaptcha

AndresQuiVal commented 2 years ago

@AndresQuiVal with hcaptcha

Sorry, I cannot se the video, seems to be unavailable, neither of the videos per se

AndresQuiVal commented 2 years ago

@rastvl After enabling the headless: false option, i've noticed that it opens the browser, but only keeps refreshing on the same site, i.e, refreshes on this part:

image

is the webpage that it opened correct? or it should open other cloudflare site, such as the challenge?

rastvl commented 2 years ago

@AndresQuiVal are you using the latest version? This should work - example

AndresQuiVal commented 2 years ago

Now it works for dekudeals.com/login image

So then i realized something, the system can only solve the challenge and get the cookies whenever it appears on some resource of the webpage something like this: image

right? does there exists other way to get the cookies without having that page facing in?

rastvl commented 2 years ago

@AndresQuiVal

So then i realized something, the system can only solve the challenge and get the cookies whenever it appears on some resource of the webpage something like this

Yes, let's say I'm working with some web page through POST/GET requests. Because of cloudflare I get a 503 response and need to solve cloudlfare challange. In this case, I send a request to the server, the server should give cookies, and then I can continue to work with my web page using the received cookies. (The system should run in headless mode to consume less RAM)

does there exists other way to get the cookies without having that page facing in?

I don't really understand in what case it might be necessary. If the cloudflare page does not appear, I usually work with the site without any problems

AndresQuiVal commented 2 years ago

Cool cool, now understand it, for other case scenario, I mean like cases in which the webpage throws some 429 status code, still that works? @rastvl

rastvl commented 2 years ago

Cool cool, now understand it, for other case scenario, I mean like cases in which the webpage throws some 429 status code, still that works? @rastvl

@AndresQuiVal 429 is "too many requests" error. I guess, u need to use more proxies or increase the delay between requests)

AndresQuiVal commented 2 years ago

Thats perfect, now the main problem is solved, yet i tried to make a request using python code and didnt worked, image and the payload (python code) is like this:

def make_cookies():

    payload = {
        "url": "https://www.dekudeals.com/login", 
        "userAgent": f"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) 100/104.0.0.0 Safari/537.36",
        "hcaptcha": ""
    }

    res = requests.post("http://localhost:3000/createTask", data=payload)
    res.raise_for_status()

    print(res.content)

Why is this happening?

rastvl commented 2 years ago

Why is this happening?

@AndresQuiVal I don't use python, so I don't really understand what's wrong here. You need to figure out why you are sending the wrong request. I think the problem is in the res = requests.post("http://localhost:3000/createTask", data=payload) line. Maybe you should write res = requests.post("http://localhost:3000/createTask", json=payload)

AndresQuiVal commented 2 years ago

@rastvl Solved, that worked, thanks!

AndresQuiVal commented 1 year ago

Hello @rastvl seems that the library is again not working, i tested for dekudeals.com/login and none of them worked, still seems to be the timeout error, does it work for you?

rastvl commented 1 year ago

Hello @rastvl seems that the library is again not working, i tested for dekudeals.com/login and none of them worked, still seems to be the timeout error, does it work for you?

It works. Example

AndresQuiVal commented 1 year ago

@rastvl I just redownloaded the library and execute it, removed the proxy use and set headless : false in constants.js and yet doesnt work, is there something wrong with the configuration?

rastvl commented 1 year ago

@AndresQuiVal Alas, I don't know why it might not work for you. I also re-downloaded the files from the repository and got the cookies without any problems. Try looking at your browser that uses playwright. I use chromium 105

AndresQuiVal commented 1 year ago

@rastvl just redownloaded the code again and not working, im using the sample script again and the chromium version is 107.0.5304

AndresQuiVal commented 1 year ago

@rastvl What version of playwright are you using, seems that I'm using a latest version since your chromium version is different, or you specified an executablePath for chromium?

UPDATE @rastvl

I tried using chromium version 105.0.5177.0 and doesnt work either, seems to be a package issue or something related to the source code, im still reading it to figure out but havent got to anything.

AndresQuiVal commented 1 year ago

Seems that cloning the project on MacOS, zipping the project and moving it to Windows worked, super strange even though where the same codebases, seems that those edge cases should be added to README.md in order for devs to consider it since we tried on 2 windows computers and none of them worked @rastvl