diff --git a/cf-clearance-scraper.go b/cf-clearance-scraper.go index eb46f3f..2150bc1 100644 --- a/cf-clearance-scraper.go +++ b/cf-clearance-scraper.go @@ -3,7 +3,6 @@ package ccs import ( "encoding/json" "errors" - "strings" "time" "github.com/Danny-Dasilva/CycleTLS/cycletls" @@ -146,14 +145,9 @@ func RequestWithWAFSession(method string, URL string, wafSession Session, option options = &cycletls.Options{} } headers := map[string]string{} - cookies := []string{} - for _, cookie := range wafSession.Cookies { - cookies = append(cookies, cookie.Name+"="+cookie.Value) - } for key, value := range wafSession.Headers { headers[key] = value } - headers["Cookie"] = strings.Join(cookies, "; ") 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"] @@ -165,6 +159,16 @@ func RequestWithWAFSession(method string, URL string, wafSession Session, option options.Headers[key] = value } + if options.Cookies == nil { + options.Cookies = []cycletls.Cookie{} + } + for _, cookie := range wafSession.Cookies { + options.Cookies = append(options.Cookies, cycletls.Cookie{ + Name: cookie.Name, + Value: cookie.Value, + }) + } + resp, err := cycletlsClient.Do(URL, *options, method) if err != nil { return resp, err