From 17c6eb6a122567b173fc6f687ebc964540d434a2 Mon Sep 17 00:00:00 2001 From: dragongoose Date: Fri, 25 Aug 2023 19:42:28 -0400 Subject: [PATCH] Fix hardcoded slug and use url encoding --- extractor/twitch/Clip.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extractor/twitch/Clip.go b/extractor/twitch/Clip.go index f706aa9..0a49bef 100644 --- a/extractor/twitch/Clip.go +++ b/extractor/twitch/Clip.go @@ -1,6 +1,7 @@ package twitch import ( + "net/url" "safetwitch-backend/extractor" "safetwitch-backend/extractor/structs" @@ -72,7 +73,7 @@ func GetClipLink(slug string) (string, error) { { "operationName": "VideoAccessToken_Clip", "variables": map[string]interface{}{ - "slug": "CovertConsideratePorcupineSwiftRage-5tq5qcrbtQ_BhHRC", + "slug": slug, }, "extensions": map[string]interface{}{ "persistedQuery": map[string]interface{}{ @@ -92,7 +93,7 @@ func GetClipLink(slug string) (string, error) { signature := gjson.Get(string(body), "0.data.clip.playbackAccessToken.signature").String() baseUrl := gjson.Get(string(body), "0.data.clip.videoQualities.0.sourceURL").String() - formattedUrl := baseUrl + "?sig=" + signature + "&token=" + token + formattedUrl := baseUrl + "?sig=" + signature + "&token=" + url.QueryEscape(token) return extractor.ProxyClip(formattedUrl), nil }