From 1ecdcb99a31b9548e29323a99eb267aa487face3 Mon Sep 17 00:00:00 2001 From: nite07 Date: Tue, 3 Dec 2024 23:47:30 +0800 Subject: [PATCH] fix --- cf-clearance-scraper.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cf-clearance-scraper.go b/cf-clearance-scraper.go index 98a077a..50d1262 100644 --- a/cf-clearance-scraper.go +++ b/cf-clearance-scraper.go @@ -139,7 +139,8 @@ func TurnstileMaxToken(ccsUrl string, requestUrl string) (string, error) { return ccsResp.Token, nil } -func RequestWithWAFSession(method string, URL string, wafSession Session, body string, headers map[string]string) (cycletls.Response, error) { +func RequestWithWAFSession(method string, URL string, wafSession Session, options cycletls.Options) (cycletls.Response, error) { + headers := map[string]string{} cookies := []string{} for _, cookie := range wafSession.Cookies { cookies = append(cookies, cookie.Name+"="+cookie.Value) @@ -149,11 +150,11 @@ func RequestWithWAFSession(method string, URL string, wafSession Session, body s } headers["Cookie"] = strings.Join(cookies, "; ") - options := cycletls.Options{ - Body: body, - Ja3: "772,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,23-27-65037-43-51-45-16-11-13-17513-5-18-65281-0-10-35,25497-29-23-24,0", - UserAgent: headers["user-agent"], - Headers: headers, + options.Ja3 = "772,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,23-27-65037-43-51-45-16-11-13-17513-5-18-65281-0-10-35,25497-29-23-24,0" + options.UserAgent = headers["user-agent"] + + for key, value := range headers { + options.Headers[key] = value } return cycletlsClient.Do(URL, options, method)