Add headers to look like a browser
This commit is contained in:
parent
a37a1a5ff1
commit
900b6bd3e7
2 changed files with 4 additions and 1 deletions
|
@ -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 {
|
||||
|
|
4
main.go
4
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")
|
||||
|
|
Loading…
Reference in a new issue