0
Fork 0
mirror of https://codeberg.org/SafeTwitch/safetwitch-backend.git synced 2024-12-22 05:02:58 -05:00

Fix hardcoded slug and use url encoding

This commit is contained in:
dragongoose 2023-08-25 19:42:28 -04:00
parent 4d66e04b27
commit 17c6eb6a12
No known key found for this signature in database
GPG key ID: 01397EEC371CDAA5

View file

@ -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
}