Use POST requests with protobuf body for videoplayback requests
All checks were successful
CI / build (push) Successful in 5m43s

https://github.com/iv-org/invidious/issues/5033
This commit is contained in:
Fijxu 2024-10-29 18:12:06 -03:00
parent 3d30033794
commit 6885fcfc28
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4

View file

@ -1,6 +1,7 @@
package main
import (
"bytes"
"io"
"log"
"net/http"
@ -12,6 +13,7 @@ import (
func videoplayback(w http.ResponseWriter, req *http.Request) {
q := req.URL.Query()
host := q.Get("host")
q.Del("host")
if len(host) <= 0 {
mvi := q.Get("mvi")
@ -60,7 +62,10 @@ func videoplayback(w http.ResponseWriter, req *http.Request) {
proxyURL.RawQuery = q.Encode()
request, err := http.NewRequest(req.Method, proxyURL.String(), nil)
// https://github.com/FreeTubeApp/FreeTube/blob/5a4cd981cdf2c2a20ab68b001746658fd0c6484e/src/renderer/components/ft-shaka-video-player/ft-shaka-video-player.js#L1097
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)