Use POST requests with protobuf body for videoplayback requests
All checks were successful
CI / build (push) Successful in 5m43s
All checks were successful
CI / build (push) Successful in 5m43s
https://github.com/iv-org/invidious/issues/5033
This commit is contained in:
parent
3d30033794
commit
6885fcfc28
1 changed files with 6 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -12,6 +13,7 @@ import (
|
||||||
func videoplayback(w http.ResponseWriter, req *http.Request) {
|
func videoplayback(w http.ResponseWriter, req *http.Request) {
|
||||||
q := req.URL.Query()
|
q := req.URL.Query()
|
||||||
host := q.Get("host")
|
host := q.Get("host")
|
||||||
|
q.Del("host")
|
||||||
|
|
||||||
if len(host) <= 0 {
|
if len(host) <= 0 {
|
||||||
mvi := q.Get("mvi")
|
mvi := q.Get("mvi")
|
||||||
|
@ -60,7 +62,10 @@ func videoplayback(w http.ResponseWriter, req *http.Request) {
|
||||||
|
|
||||||
proxyURL.RawQuery = q.Encode()
|
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)
|
copyHeaders(req.Header, request.Header, false)
|
||||||
request.Header.Set("User-Agent", ua)
|
request.Header.Set("User-Agent", ua)
|
||||||
|
|
Loading…
Add table
Reference in a new issue