mirror of
https://codeberg.org/SafeTwitch/safetwitch-backend.git
synced 2024-12-22 13:13:00 -05:00
Fix hardcoded slug and use url encoding
This commit is contained in:
parent
4d66e04b27
commit
17c6eb6a12
1 changed files with 3 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
package twitch
|
package twitch
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/url"
|
||||||
"safetwitch-backend/extractor"
|
"safetwitch-backend/extractor"
|
||||||
"safetwitch-backend/extractor/structs"
|
"safetwitch-backend/extractor/structs"
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@ func GetClipLink(slug string) (string, error) {
|
||||||
{
|
{
|
||||||
"operationName": "VideoAccessToken_Clip",
|
"operationName": "VideoAccessToken_Clip",
|
||||||
"variables": map[string]interface{}{
|
"variables": map[string]interface{}{
|
||||||
"slug": "CovertConsideratePorcupineSwiftRage-5tq5qcrbtQ_BhHRC",
|
"slug": slug,
|
||||||
},
|
},
|
||||||
"extensions": map[string]interface{}{
|
"extensions": map[string]interface{}{
|
||||||
"persistedQuery": 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()
|
signature := gjson.Get(string(body), "0.data.clip.playbackAccessToken.signature").String()
|
||||||
|
|
||||||
baseUrl := gjson.Get(string(body), "0.data.clip.videoQualities.0.sourceURL").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
|
return extractor.ProxyClip(formattedUrl), nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue