Skip to content

Commit 5812b74

Browse files
committed
Use Twitch app headers to bypass integrity checks
1 parent f086dea commit 5812b74

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

internal/pkg/config/integrity.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (c *Config) refreshIntegrityToken() error {
8080
}
8181

8282
func getClientVersion() (string, error) {
83-
resp, err := utils.HttpGet(twitch.TwitchHomeUrl, nil)
83+
resp, err := utils.HttpGet(twitch.HomeUrl, nil)
8484
if err != nil {
8585
return "", err
8686
}

internal/pkg/twitch/defaults.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
package twitch
22

3-
const TwitchHomeUrl = "https://www.twitch.tv/"
3+
const HomeUrl = "https://www.twitch.tv/"
44
const IntegrityUrl = "https://gql.twitch.tv/integrity"
55
const GqlApiUrl = "https://gql.twitch.tv/gql"
6-
const DefaultClientId = "kimne78kx3ncx6brgo4mv6wki5h1ko"
7-
const DefaultUserAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36"
6+
7+
const DefaultClientId = "kd1unb4b3q4t58fwlpcbzcbnm76a8fp"
8+
const DefaultUserAgent = "Dalvik/2.1.0 (Linux; U; Android 7.1.2; SM-N976N Build/N2G48C) tv.twitch.android.app/13.9.0/1309000"
9+
const DefaultAppVersion = "13.9.0"
10+
const DefaultAcceptHeader = "application/vnd.twitchtv.v3+json"
11+
const DefaultApiConsumerType = "mobile; Android/1309000"

internal/pkg/twitch/gql/gql.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,13 @@ func post(config *config.Config, request any) ([]byte, error) {
2323
if err != nil {
2424
return nil, fmt.Errorf("error creating HTTP request: %w", err)
2525
}
26+
2627
req.Header.Set("Client-ID", twitch.DefaultClientId)
2728
req.Header.Set("User-Agent", twitch.DefaultUserAgent)
29+
req.Header.Set("X-App-Version", twitch.DefaultAppVersion)
30+
req.Header.Set("Accept", twitch.DefaultAcceptHeader)
31+
req.Header.Set("Api-Consumer-Type", twitch.DefaultApiConsumerType)
2832
if config != nil {
29-
integrityToken, err := config.GetIntegrityToken()
30-
if err != nil {
31-
return nil, fmt.Errorf("could not get integrity token: %w", err)
32-
}
33-
req.Header.Set("Client-Integrity", integrityToken)
3433
req.Header.Set("Client-Session-Id", config.GetClientSessionId())
3534
req.Header.Set("Client-Version", config.GetClientVersion())
3635
req.Header.Set("Authorization", "OAuth "+config.GetAuthToken())

0 commit comments

Comments
 (0)