From d34ae7399760417937ff51ce0d214462023c39fe Mon Sep 17 00:00:00 2001 From: nite07 Date: Wed, 4 Dec 2024 21:50:23 +0800 Subject: [PATCH] modify RequestWithWAFSession --- cf-clearance-scraper.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cf-clearance-scraper.go b/cf-clearance-scraper.go index b2514b4..eb46f3f 100644 --- a/cf-clearance-scraper.go +++ b/cf-clearance-scraper.go @@ -165,5 +165,12 @@ func RequestWithWAFSession(method string, URL string, wafSession Session, option options.Headers[key] = value } - return cycletlsClient.Do(URL, *options, method) + resp, err := cycletlsClient.Do(URL, *options, method) + if err != nil { + return resp, err + } + if resp.Status == 403 { + return resp, errors.New("Cloudflare blocked request") + } + return resp, nil }