Record Twitch Live streams & Upload to Google Drive if needed
This program can monitor and record multiple Twitch streams live and convert it to .mp4 files.
- Download the latest release binary for your platform from Releases
- Run the program - it will auto-generate a config template on first run
- Configure your Twitch credentials in
config.json - Start recording - run again and it will begin monitoring your channels
- FFmpeg - Required for video recording
- Go 1.25+
- Git
- Visit https://dev.twitch.tv/console
- Click "Register Your Application"
- Fill in:
- OAuth Client ID: Your app name
- OAuth Redirect URLs:
http://localhost:8080/callback - Category: Select any category
- Click "Register"
- Copy your Client ID and click "New Secret" to reveal your Client Secret
The OAuth key bypasses ads if you have Twitch Turbo and enables higher quality streams.
- Log in to https://twitch.tv in your browser
- Open Developer Console (F12 or Ctrl+Shift+I / Cmd+Option+I on Mac)
- Go to Console tab
- Paste and run this command:
document.cookie .split('; ') .find((item) => item.startsWith('auth-token=')) ?.split('=')[1];
- Copy the 30-character result
- Add to config.json as
"oauth_key"
To revoke: Change password or visit https://www.twitch.tv/settings/security
Update vod_directory in config.json to your preferred path:
- Windows:
"vod_directory": "C:\\Users\\YourName\\TwitchRecordings" - Mac/Linux:
"vod_directory": "/home/yourname/twitch-recordings"
Replace the example channel with Twitch channels you want to record:
"channels": ["channel1", "channel2", "channel3"]To automatically fetch and save chat logs for recorded streams:
- Set
"logs.enabled": truein config.json - The recorder will automatically fetch chat logs after each stream ends
- Chat logs are saved as
{stream_id}_chat.jsonin the same directory as the MP4 file - Logs contain raw chat data from Twitch's API (messages, timestamps, user info, badges, etc.)
Note: Chat logs are fetched asynchronously after the VOD is processed by Twitch. The file will be saved alongside your recording.
To enable automatic uploads to Google Drive after recording:
- Visit https://developers.google.com/drive/api/v3/enable-drive-api
- Create a new project and enable Drive API v3
- Go to Credentials → Create OAuth 2.0 Client ID
- Use https://developers.google.com/oauthplayground/:
- Click gear icon ⚙️ → Check "Use your own OAuth credentials"
- Enter your Client ID and Secret
- Select scopes:
Drive API v3→drive,drive.file,drive.metadata - Authorize and exchange for tokens
- Copy credentials to config.json:
drive.refresh_token: Your refresh tokendrive.access_token: Your access tokengoogle.client_id: Your Google OAuth Client IDgoogle.client_secret: Your Google OAuth Client Secret
- Run with
-driveflag to enable uploads
Folder Structure: Recordings are organized as channel/streamID/file.mp4 in Drive.
Token Refresh: Expired tokens are automatically refreshed using the refresh token.
Progress Tracking: Upload progress is shown in real-time with percentage and file size.
The program auto-generates config.json on first run. Update these fields:
{
"twitch": {
"client_id": "YOUR_TWITCH_CLIENT_ID",
"client_secret": "YOUR_TWITCH_CLIENT_SECRET",
"oauth_key": ""
},
"vod_directory": "./recordings",
"channels": ["example_channel"],
"twitch_app": {},
"drive": {
"refresh_token": "",
"access_token": ""
},
"google": {
"client_id": "",
"client_secret": "",
"scopes": [
"https://www.googleapis.com/auth/drive",
"https://www.googleapis.com/auth/drive.appdata",
"https://www.googleapis.com/auth/drive.file",
"https://www.googleapis.com/auth/drive.metadata"
],
"endpoint": {
"token_url": "https://oauth2.googleapis.com/token"
}
},
"archive": {
"enabled": false,
"endpoint": "", // Supports {channel} placeholder
"key": ""
},
"logs": {
"enabled": false // Fetch and save chat logs for recorded streams
}
}| Field | Required | Description |
|---|---|---|
twitch.client_id |
Yes | From Twitch Developer Console |
twitch.client_secret |
Yes | From Twitch Developer Console |
twitch.oauth_key |
No | Browser auth token (bypass ads with Turbo) |
vod_directory |
Yes | Where to save recorded videos |
channels |
Yes | Array of Twitch channel names to monitor |
drive.refresh_token |
No* | Google Drive refresh token |
drive.access_token |
No* | Google Drive access token |
google.client_id |
No* | Google OAuth Client ID |
google.client_secret |
No* | Google OAuth Client Secret |
logs.enabled |
No | Fetch and save chat logs for streams |
*Required only if using -drive flag
./twitch-recorder-go -config ./config.json-config- Path to config file (default: ./config.json)-drive- Enable Google Drive upload (requires drive credentials in config)-loglevel- Set log level: error, warn, info, debug (default: info)
Recorded videos are saved as {stream_id}.mp4 in the configured vod_directory.
When logs.enabled is true, chat logs are saved as {stream_id}_chat.json alongside the video file. The JSON contains an array of raw chat message objects with:
- Message content and timestamp
- User information (ID, username, display name)
- Message metadata (likes, edits, position in stream)
- All fields from Twitch's GQL API response
-
Install Go 1.25+
-
Clone the repository:
git clone https://github.com/OP-Overpowered/twitch-recorder-go.git cd twitch-recorder-go -
Build:
go build -o twitch-recorder-go ./cmd/twitch-recorder
On Windows, this creates
twitch-recorder-go.exe. -
Run:
./twitch-recorder-go -config ./config.json # Or on Windows: twitch-recorder-go.exe -config .\config.json
- ❌ Removed streamlink dependency - FFmpeg is now the only download method
- ❌ Removed
-ffmpegflag - FFmpeg is always used - ✅ Auto-generates config.json on first run with setup instructions
⚠️ Requires Go 1.25+ for building from source