Open Eduardobec01 opened 1 year ago
Hello @rastvl , when moving the cookies of the session to the createTask/ endpoint they seemed in some cases to not be taken into account, those cookies and session info indeed has a 429 status, therefore if we move those cookies to the createTask/ the chrome window should open the challenge window, but seems that in some cases does not open it, it just opens the url specified without the challenge, how to solve this situation? Thanks
Hello @Eduardobec01
Sorry, but I don't really understand what you're doing. It should work like this: with /createTask you tell which page the cloudflare challenge is on, then with /checkTask you get all the cookies that cloudflare sets in the response headers via the Set-Cookie
header.
If you import the resulting cookies into your program correctly, you should not encounter cloudflare challenge at all.
If you get any errors, you are doing something wrong. For example, the user-agent or proxy in the headless browser of this repository and in your program doesn't match. It could also be that cloudflare detects the request library you use in your program and blocks it (TLS and JA3 fingerprints). It's also possible that the site you're working with requires not only cloudflare cookies, but something else as well.
@rastvl I think what he is talking about is that he is sending some "proccesed" cookies that are supposed to be taken into account inside the playwright context, but seems that the code does not have intention to receive any cookies, only to open the specified url and solve the challenge. I have modified the playwright code to receive cookies after creating the context
NOTE: the cookies are received from the req headers, there seems to be no error when setting the cookies
Yet the window does not receive them, is there any background or hidden code that blocks cookies from being passed to playwright window? @rastvl
@AndresQuiVal
seems that the code does not have intention to receive any cookies, only to open the specified url and solve the challenge.
A listener is installed on the page, which handles requests. As soon as it sees the Set-Cookie
"cf_clearance" in the header, it sets the task to resolved status (line 35 here)
Yet the window does not receive them, is there any background or hidden code that blocks cookies from being passed to playwright window?
There is no background code that blocks anything
@AndresQuiVal
seems that the code does not have intention to receive any cookies, only to open the specified url and solve the challenge.
A listener is installed on the page, which handles requests. As soon as it sees the
Set-Cookie
"cf_clearance" in the header, it sets the task to resolved status (line 35 here)Yet the window does not receive them, is there any background or hidden code that blocks cookies from being passed to playwright window?
There is no background code that blocks anything
Hello @rastvl , thanks for the reply, the Set-Cookie
header you are talking about is for retrieving the challenge cookies, but if we want to send some cookies while creating the task with the createTask/
in order to the window has some preloaded info, it does not work.
@AndresQuiVal
seems that the code does not have intention to receive any cookies, only to open the specified url and solve the challenge.
A listener is installed on the page, which handles requests. As soon as it sees the
Set-Cookie
"cf_clearance" in the header, it sets the task to resolved status (line 35 here)Yet the window does not receive them, is there any background or hidden code that blocks cookies from being passed to playwright window?
There is no background code that blocks anything
Hello @rastvl , thanks for the reply, the
Set-Cookie
header you are talking about is for retrieving the challenge cookies, but if we want to send some cookies while creating the task with thecreateTask/
in order to the window has some preloaded info, it does not work; hope im being clear.
@AndresQuiVal
Hello @rastvl , thanks for the reply, the
Set-Cookie
header you are talking about is for retrieving the challenge cookies, but if we want to send some cookies while creating the task with thecreateTask/
in order to the window has some preloaded info, it does not work.
Now I get it. I really didn't add that functionality.
In general, if you are just worried about cloudflare, you can just take the script from the scripts/overrides.js
file and use it in any tool like selemium/puppeteer/playwright, etc..
@AndresQuiVal
Hello @rastvl , thanks for the reply, the
Set-Cookie
header you are talking about is for retrieving the challenge cookies, but if we want to send some cookies while creating the task with thecreateTask/
in order to the window has some preloaded info, it does not work.Now I get it. I really didn't add that functionality. In general, if you are just worried about cloudflare, you can just take the script from the
scripts/overrides.js
file and use it in any tool like selemium/puppeteer/playwright, etc..
No prob @rastvl , later on I will submit a pull-request with the code with that funcitonality of using cookies previously set, if you want it to accept it though.
Hello @rastvl , when moving the cookies of the session to the createTask/ endpoint they seemed in some cases to not be taken into account, those cookies and session info indeed has a 429 status, therefore if we move those cookies to the createTask/ the chrome window should open the challenge window, but seems that in some cases does not open it, it just opens the url specified without the challenge, how to solve this situation? Thanks