From 900b6bd3e79b591a4cca6ad55d5018a65bb25501 Mon Sep 17 00:00:00 2001 From: Fijxu Date: Wed, 30 Oct 2024 03:08:24 -0300 Subject: [PATCH] Add headers to look like a browser --- httppaths.go | 1 - main.go | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/httppaths.go b/httppaths.go index 23e00d4..153eaa3 100644 --- a/httppaths.go +++ b/httppaths.go @@ -66,7 +66,6 @@ func videoplayback(w http.ResponseWriter, req *http.Request) { body := []byte{0x78, 0} // protobuf body request, err := http.NewRequest("POST", proxyURL.String(), bytes.NewReader(body)) - copyHeaders(req.Header, request.Header, false) request.Header.Set("User-Agent", ua) if err != nil { diff --git a/main.go b/main.go index 687105e..ef24e61 100644 --- a/main.go +++ b/main.go @@ -174,6 +174,10 @@ func beforeAll(next http.HandlerFunc) http.HandlerFunc { atomic.AddInt64(&stats_.RequestCount, 1) + // To look like more like a browser + req.Header.Add("Origin", "https://www.youtube.com") + req.Header.Add("Referer", "https://www.youtube.com/") + w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Access-Control-Allow-Headers", "*") w.Header().Set("Access-Control-Max-Age", "1728000")