From e7b3f87211253fd7b98ddaddc05a364890415f6b Mon Sep 17 00:00:00 2001 From: garret Date: Tue, 2 Jul 2024 16:19:48 +0100 Subject: detect cloudflare block --- fetch-status.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'fetch-status.py') diff --git a/fetch-status.py b/fetch-status.py index 9aa2480..88e3bb7 100755 --- a/fetch-status.py +++ b/fetch-status.py @@ -36,6 +36,7 @@ profile_post = soup.find("div", attrs={ }) is_loginwall = soup.find("html", class_='has-no-js template-login') != None +is_cloudflare_block = soup.find("title").text == "Just a moment..." if profile_post is None: print("Content-Type: text/plain; charset=utf-8") if is_loginwall: @@ -43,6 +44,11 @@ if profile_post is None: print() print("🚨🚨🚨 schizo alert! 🚨🚨🚨") print("it won't work if you don't expose your profile to the public, sorry") + elif is_cloudflare_block: + print("status: 403") + print() + print("blocked by cloudflare :(") + print("i've found it to work from my home ip, probably this is hosted on a datacentre one...") else: print("Status: 500") print() -- cgit v1.2.3-70-g09d2