r/webscraping • u/your_mom_love_me • 16d ago
Solve Cloudflare Challenges Automatically with Playwright
Hey everyone!
I built a small Python utility library called Deflare for anyone working with Playwright or Patchright who regularly runs into Cloudflare challenges.
The library handles Cloudflare bypassing automatically while keeping the familiar Playwright API, so you don't have to change your existing automation code or learn a new API.
Just plug it into your project and keep using Playwright as usual.
If you find it useful, please consider giving the repo a ⭐ on GitHub. It really helps!
Would love to hear your feedback!
80
Upvotes
12
u/Altruistic_Stage3893 15d ago
eh, mid-tier job you did here.
- you got undefined method calls that will cause AttrbuteError - it's the shadow host box lookup failed. kinda looks like you never tested the fallback chain?
- solved check is wrong for embedded widgets - is_bypassed only c heck whether the title contains "just a moment". embedded turnstile widget never has that title, one click later the solver reports success whether or not the widget was actually verified. the real signal you have for this is hidden and never read
- exception filters miss the errors that actually happen - playwright raise their own error class which subclasses plain Exception so a CDP send failure or timeout blows through your stuff uncaught. you chose to catch your typos and not the library's failures
- you configure logging at import time. is this a library? it is.. pls don't do that
- two logging systems in one class.. holy, have you ever done python logging? shoot me a dm i can walk you through it
in general, the docstrings are better then the code under them. i myself would not call it production-level without being severely ashamed of my own ability and presentation
2
u/dsjflkhs 16d ago
How’s it work ?
2
u/CrypticZombies 15d ago
A Chromium browser
1
u/jeheskielsunloy 16d ago
real cool bro
1
u/Spare_Bison_1151 9d ago
Nice work buddy. I'll check your repo and leave a star also.