Skip to content

Commit

Permalink
Update Cloudflare challenge detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostwords committed Oct 24, 2023
1 parent e8d81e9 commit 9cbed34
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,11 +626,12 @@ def raise_on_security_pages(self):
"""
page_title = self.driver.title

if page_title == "Attention Required! | Cloudflare":
raise WebDriverException("Reached Cloudflare security page")
if page_title in ("Attention Required! | Cloudflare", "Just a moment..."):
if 'https://challenges.cloudflare.com' in self.driver.page_source:
raise WebDriverException("Reached Cloudflare security page")

# TODO this seems to be out of date
if page_title == "You have been blocked":
elif page_title == "You have been blocked":
if "https://ct.captcha-delivery.com/c.js" in self.driver.page_source:
raise WebDriverException("Reached DataDome security page")

Expand Down

0 comments on commit 9cbed34

Please sign in to comment.