Use mvi and mn query params to build host url
All checks were successful
CI / build (push) Successful in 1m30s

This commit is contained in:
Fijxu 2024-10-08 21:47:00 -03:00
parent 9b1acecf42
commit 64ad2fc28f
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4

23
main.go
View file

@ -99,22 +99,25 @@ func (*requesthandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
}
q := req.URL.Query()
host := q.Get("host")
q.Del("host")
if len(host) <= 0 {
host = q.Get("hls_chunk_host")
}
// https://rr(mvi)---(mn).googlevideo.com
if len(host) <= 0 {
host = getHost(req.URL.EscapedPath())
}
mvi := q.Get("mvi")
mn := strings.Split(q.Get("mn"), ",")
if len(host) <= 0 {
io.WriteString(w, "No host in query parameters.")
if len(mvi) <= 0 {
io.WriteString(w, "No `mvi` in query parameters")
return
}
if len(mn) <= 0 {
io.WriteString(w, "No `mn` in query parameters")
return
}
host := "rr" + mvi + "---" + mn[0] + ".googlevideo.com"
q.Del("host")
parts := strings.Split(strings.ToLower(host), ".")
if len(parts) < 2 {