Skip to content

Commit 0d3b795

Browse files
committed
Fix followed games: send the query document instead of a persisted query
_get_followed() used a hardcoded persisted-query sha256 hash. Twitch rotates those hashes, and this one is no longer known, so the call only ever answers with PersistedQueryNotFound and "followed games" comes up empty. Send the full query document instead. The batched request and response shape stay the same, and so do the returned fields (id, name, displayName, boxArtURL, viewersCount), so callers need no change. Verified against gql.twitch.tv with a user token: the persisted variant returns PERSISTED_QUERY_NOT_FOUND, the query document returns the nodes.
1 parent 5f72ebc commit 0d3b795

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

‎resources/lib/twitch/api/helix/games.py‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,17 @@ def _check_follows(username, name, headers={}):
5353
# undocumented / unsupported
5454
@query
5555
def _get_followed(limit=100, headers={}):
56+
# Full query document rather than a persisted query: Twitch rotates the persisted
57+
# hashes, and the previous one now only answers with PersistedQueryNotFound.
5658
data = [{
5759
"operationName": "FollowingGames_CurrentUser",
5860
"variables": {
5961
"limit": limit,
6062
"type": "LIVE"
6163
},
62-
"extensions": {
63-
"persistedQuery": {
64-
"version": 1,
65-
"sha256Hash": "8446d4d234005813dc1f024f487ce95434c3e4202f451dd42777935b5ed035ce"
66-
}
67-
}
64+
"query": "query FollowingGames_CurrentUser($limit: Int!, $type: FollowedGamesType!) {"
65+
" currentUser { followedGames(first: $limit, type: $type) {"
66+
" nodes { id name displayName boxArtURL viewersCount } } } }"
6867
}]
6968
q = GQLQry('', headers=headers, data=data, use_token=False)
7069
return q

0 commit comments

Comments
 (0)