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

Add cursor

This commit is contained in:
dragongoose 2023-06-02 08:13:36 -04:00
parent b1f8aa87fd
commit 36cc5a0c40
No known key found for this signature in database
GPG key ID: 50DB99B921579009

View file

@ -191,6 +191,7 @@ func GetDiscoveryPage(limit int, cursor string) ([]structs.CategoryPreview, erro
"sort": "RELEVANCE", "sort": "RELEVANCE",
"tags": []string{}, "tags": []string{},
}, },
"cursor": cursor,
}, },
"extensions": map[string]interface{}{ "extensions": map[string]interface{}{
"persistedQuery": map[string]interface{}{ "persistedQuery": map[string]interface{}{
@ -225,6 +226,7 @@ func GetDiscoveryItem(name string, streamLimit int, cursor string) (structs.Cate
{ {
"operationName": "DirectoryPage_Game", "operationName": "DirectoryPage_Game",
"variables": map[string]interface{}{ "variables": map[string]interface{}{
"cursor": cursor,
"imageWidth": 50, "imageWidth": 50,
"name": name, "name": name,
"options": map[string]interface{}{ "options": map[string]interface{}{
@ -411,7 +413,29 @@ func GetStream(streamerName string) (string, error) {
// holy zooks, what the scallop??? we got the playlist, houston!!! // holy zooks, what the scallop??? we got the playlist, houston!!!
// time to proxy all the urls!!! // time to proxy all the urls!!!
proxiedPlaylist := ProxyPlaylistFile(string(playlistFile)) proxiedPlaylist := ProxyPlaylistFile(string(playlistFile), false)
return proxiedPlaylist, nil return proxiedPlaylist, nil
} }
func GetSubPlaylist(rawurl string) (string, error) {
req, err := http.NewRequest("GET", rawurl, nil)
req.Header.Add("Client-Id", "ue6666qo983tsx6so1t0vnawi233wa")
if err != nil {
return "", err
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
return "", err
}
playlistFile, err := io.ReadAll(resp.Body)
if err != nil {
return "", err
}
proxiedPlaylist := ProxyPlaylistFile(string(playlistFile), true)
return proxiedPlaylist, nil
}