-
Notifications
You must be signed in to change notification settings - Fork 542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WiP: Fix looping Cloudflare challenge, Resolves #1036 #1163
base: master
Are you sure you want to change the base?
Conversation
FWIW But after each solve there remains a chrome subtask that starts to spin up to 15% CPU and I have to manually kill them off. |
Another thing that I've noticed is that in the user-agent headless replacement: self.execute_cdp_cmd(
"Network.setUserAgentOverride",
{
"userAgent": self.execute_script(
"return navigator.userAgent"
).replace("Headless", "")
},
) I don't know why but If I hardcode the user-agent using the exact that my computer has like this: user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
options.add_argument(f"--user-agent={user_agent}") it bypasses cloudflare, but if i put this to make it automatically like you have it on line 533 from So an alternative could be to setup a driver only to get the user agent: def get_user_agent(driver):
return driver.execute_script("return navigator.userAgent;").replace("Headless", "") And then pass the user-agent to the definitive driver PD: I only can tell you what I've discovered to see if we can go through the solution cuz I'm having troubles to get the project installed/set up 😅 |
I didnt actually use this branch, it worked fine after I switched to it. Thanks |
@garfield69 yea this seems to be an issue with Chrome v124. You can revert to v123 in the mean time if it's easier - #1161 Alternatively, build your own binaries, which will use Chromium v123:
|
@m33ts4k0z were you doing this on Windows? |
Yes on a Windows 11 VM on Unraid but it did work in the end. I updated my first post here with the cause. |
Oh cool, did not know I could build on windows. |
@juanfrilla sorry for the delay in replying, been busy and only got to a few quick ones on my phone. I'll have a look at the UA idea when I next get a chance, thanks. Assuming you're following the run from source instructions, what issue are you having? https://github.com/FlareSolverr/FlareSolverr#from-source-code |
@ilike2burnthing my main problem is that i cannot install Xvfb on MacOS |
Tried XQuartz? |
yessir now the project is set up, let's see what I can fix |
What exactly is left to do on this to get it merge? I tried to guess with the comments here and some different issues but I can't get the current status of this. It seems to be stale for quite some time, so what's needed? |
|
Well, I made my own implementation of this "new tab" idea and I was able to make it work with every website I could (ext.to, www3.yggtorrent.cool, dodi-repacks.site, hd-torrents.me/login.php, nhentai.net) on my Linux system using a VPN / socks5 proxy and also with my container image on my own remote Linux server, which was blocked by cloudflare too. Public image with my edits: 21hsmw/flaresolverr:fixlooping |
That's working 95% of the time on Windows for me, even with a proxy, but failing 95% of the time on Docker. Usual error:
Seems it's related to |
When you say it fails on Docker, is it still on Windows or Linux? I got this error on Linux while doing my implementation, but have not been able to replicate it since. For the looping challenges, it seems to be a timing issue. Playing with the timer values can make it work in some cases, but it's not easy to know what works for everyone since it seems to take network latency into account. For example, if I use a proxy close to my location, it works 100% of the time with the sites I listed earlier, but if I use a proxy very far from me, it works 50% of the time. |
Linux. I'll play around with timings again (I did a bunch yesterday), see if I can get something that works both on my Docker and Windows. |
Strange then. I'm able to solve the challenges of all sites I try on my Debian and Fedora systems with different VPNs/Proxies with and without Docker involved. Here's an example with dodi-repacks.site using the docker image I shared previously: |
This comment was marked as off-topic.
This comment was marked as off-topic.
Thanks for your workaround @21hsmw Working with @aevrard the solution you provide will kill the killswitch if you're using something like gluetun... |
Thanks @21hsmw ! |
Worked for me on whatbox.ca services:
flaresolverr:
image: 21hsmw/flaresolverr:fixlooping
environment:
- LOG_LEVEL=${LOG_LEVEL:-info}
- LOG_HTML=${LOG_HTML:-false}
- CAPTCHA_SOLVER=${CAPTCHA_SOLVER:-none}
- TZ=UTC
- PORT=25000
- HOST=127.0.0.1
network_mode: host
pull_policy: always
restart: unless-stopped |
replacing the image of the dockerfile for this: I tested as well on a centOS server with the previous image ( |
Got round to doing some testing, and I can see what you mean about nodriver being very verbose in debug. Just tried on Docker so far, and it's working faster and with more success than the current release. However, there's definitely a memory leak: Usage after several requests: Usage after restart: There was even a couple of instances of a runaway leak that near locked up my system until I killed the Chromium processes, but still leaving a hefty chunk of memory used by Python: I'm also getting occasional stalls that are only resolved by killing the Chromium processes or restarting the container, and which I can't reproduce with the same URL after (test URLs are just those from #1036). I can run other requests at the same time, which complete successfully. It always seems to be on the mouse move step:
I did notice though that killing Chromium doesn't result in an error for FlareSolverr. |
I did find one URL which consistently caused issues: https://ilcorsaroblu.org/index.php?page=torrents&category=0&options=0&active=0&order=3&by=2 Whereas https://ilcorsaroblu.org/index.php was fine. |
I can confirm this too, it seems to be worse on some site like you reported. As for the zombie processes, I think I fixed it with a function in Flaresolverr, but the memory leak thing is worse than I expected and really needs some deep analysis. |
I noticed some problems |
Hi, I found a new issues. I want to know if I need to destroy asyncio every time I exit the function or use asyncio for all pages. At the same time, when checking the challenge, the number of nodes is re-fetched with each query, which leads to a high memory footprint. I think we can start by getting the tree of nodes and passing it as a parameter.
At the same time, nodrive's Tab and Browser seem to have circular references, which can't be released properly。 Finally, I occasionally had chrome fail to start when using docker, but it returned to normal after rediscovering the request, I wonder if you have the same issue
|
@xinghui233 Thanks for pointing this out. I came to the same conclusion when I did my research on this memory leak, and I was able to reduce it significantly by reusing the nodes instead of recreating them. There's still a small amount of memory consumption per run, but it's very different from the multi-GB leak we saw before. As for the error, I had this in the very early stage of the nodriver implementation and have never seen it again. Since the container is running with a specific user and the sandbox is disabled, this error should not appear unless there is something else, but I can't replicate it with my setup at least. |
@ilike2burnthing I pushed a new image with all the changes to docker hub. If you have some time, can you test it and report back? |
Yea, I'll try to do this later on today. |
Using your latest image I'm getting some weird issues, in particular FlareSolverr just stalling and Chromium not closing. Using the same troublesome link as before:
So we're just stopped at moving the mouse for ~80s, and only when the timeout is reached does it stop. Trying it again, the everything seems to work fine (although memory usage is very high), the challenge is solved, but we again just stall until timeout:
In some cases, Chromium continues to run, but in this case Python is just taking up 35% of my memory. I'm also having an issue with invalid cookies when using a proxy:
Without a proxy/VPN I get the error above when accessing However, when testing with I'll test on Windows later, where I can more easily test with the proxy passed to FlareSolverr versus a systemwide VPN. Lastly, thanks again for all your work, I'm very appreciative. |
@ilike2burnthing Thank you for testing again. Unfortunately, I don't seem to be able to replicate any of these errors. My guess would be that it works differently depending on the system specs. I'm running on a very recent Intel CPU, I'm limiting my test to 2 cores, but they're still very powerful, so that might explain why it's fast and in a good working state for me. About the cookies, when you say invalid, do you mean that you can't reuse them with another browser and/or with flaresolverr itself? |
https://www.asustor.com/product/spec?p_id=44 Testing those links through Jackett, and it reports that the cookies for those two sites are invalid. |
I have set up Flaresolverr, Jackett and Prowlarr in containers and I have tested the last 2 sites you talked about: I set up Flaresolverr in both Prowlarr and Jackett, added the indexers, created an account on seatracker to test it out, and was able to get both to work with Flaresolverr using my image on docker hub. I tried a few searches, both Prowlarr and Jackett works and I'm able to download torrent files or get the magnets. I also tried https://ilcorsaroblu.org with Jackett and Prowlarr and both worked. It was slow, but eventually it worked. Do you have another system running linux (live system can also be tried) with a different CPU that you can try the stack on? |
This comment was marked as duplicate.
This comment was marked as duplicate.
Hi, not sure if this is ther "same" issue, but im getting |
Can you provide us some come to try to reproduce the error?
|
Not sure i understand what youre asking for? I have Prowlarr setup to use Flaresolverr, it works fine for all sites (indexers) i have except |
In prowlarr, try changing flaresolver "timeout" setting to 180 if you haven't before, sometimes it can exceed 60 (the default). At least for the nodriver and fixlooping containers mentioned above it worked in my case. |
@21hsmw can you try those with an HTTP proxy enabled in Jackett? |
doesnt work for me even with 180. |
Have you set the |
I found a working HTTP proxy online, set it up in Jackett and verified in the flaresolverr logs that it was being used in the incoming command. I was then able to go through the cf challenge and search for torrents for the 3 websites. |
I'll try on Windows |
ok this worked for |
If running with debug logging isn't giving you additional output, you're doing something wrong. You're setting the |
Last week, 21hsmw/flaresolverr:nodriver worked 90% of time on my Debian ARM (without VPN or proxy) but it doesn't work anymore since the update from 4-5 days ago.
And when I try again I've this :
Hope this will help your invetigations ! |
Since I'm accessing to pdf urls, a problem i'm facing it's that sometimes the "No space left on device" message appears and it stop working until free space it's available, how can I automatically remove temporal files or how can I not download anything cuz I dont need it? |
That's probably because I changed to reusing the nodes. Instead of being re-created like before, they are taken at a certain point in time, which could lead to missing elements. I'll see what I can do about that.
Nodriver deletes all user data directories when it exits, which in our case is when flaresolverr is completely stopped, so that might explain why you are getting this. |
Sorry... to be clear, there was additional information in the logs, but when initiating a test for CinemaZ, there was no additional data provided by the Flaresolverr logs. |
@daNutzzzzz provide the log please. |
Flaresolverr
Prowlarr
|
Thanks to @juanfrilla for #1036 (comment).
Unfortunately, currently this only works on Windows, and the looping challenges return if using proxies or VPNs.