π¦ ClawHub
Twitch Clip
by @djc00p
Create Twitch clips of the current live stream via the Twitch API. Use when a streamer says "clip that", "clip the last X seconds", "make a clip", "clip it",...
TERMINAL
clawhub install twitch-clipπ About This Skill
name: twitch-clip metadata: {"clawdbot":{"emoji":"π¬","requires":{"bins":["curl"],"env":["TWITCH_CLIENT_ID","TWITCH_ACCESS_TOKEN","TWITCH_BROADCASTER_ID"]},"os":["linux","darwin"]}} description: Create Twitch clips of the current live stream via the Twitch API. Use when a streamer says "clip that", "clip the last X seconds", "make a clip", "clip it", or any variation requesting a clip of the current broadcast. Requires Twitch API credentials configured in environment variables. Has a 30-second cooldown between clips to prevent spam.
Twitch Clip Skill
Creates a clip of the last 30β60 seconds of a live Twitch stream via the Twitch Clips API. Includes a 30-second cooldown to prevent accidental spam clipping.
Setup
1. Create a Twitch app
1. Go to https://dev.twitch.tv/console/apps 2. Register a new app (OAuth Redirect URL:http://localhost, Category: Other)
3. Copy your Client ID and generate a Client Secret2. Get an OAuth token
Visit this URL in your browser (replaceYOUR_CLIENT_ID):
https://id.twitch.tv/oauth2/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=http://localhost&response_type=token&scope=clips:edit
Copy the access_token from the redirect URL.3. Set environment variables
export TWITCH_CLIENT_ID="your_client_id"
export TWITCH_ACCESS_TOKEN="your_access_token"
export TWITCH_BROADCASTER_ID="your_broadcaster_id" # numeric user ID
To find your broadcaster ID:
curl -s -H "Authorization: Bearer $TWITCH_ACCESS_TOKEN" \
-H "Client-Id: $TWITCH_CLIENT_ID" \
https://api.twitch.tv/helix/users | python3 -c "import json,sys; print(json.load(sys.stdin)['data'][0]['id'])"
Usage
Run the clip script:
bash scripts/create_clip.sh [duration_seconds]
Cooldown
A 30-second cooldown is enforced between clips. If a clip request comes in during cooldown:
β³ Cooldown active β try again in XsTrigger phrases
Response format
Success:
Clipped! π¬ https://clips.twitch.tv/
Cooldown active:
β³ Cooldown active β try again in Xs
Not live:
Stream is offline β can't clip right now
Token refresh
Tokens expire. If you get a 401 error, re-authorize using the URL in Setup step 2.π‘ Examples
Run the clip script:
bash scripts/create_clip.sh [duration_seconds]
βοΈ Configuration
1. Create a Twitch app
1. Go to https://dev.twitch.tv/console/apps 2. Register a new app (OAuth Redirect URL:http://localhost, Category: Other)
3. Copy your Client ID and generate a Client Secret2. Get an OAuth token
Visit this URL in your browser (replaceYOUR_CLIENT_ID):
https://id.twitch.tv/oauth2/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=http://localhost&response_type=token&scope=clips:edit
Copy the access_token from the redirect URL.3. Set environment variables
export TWITCH_CLIENT_ID="your_client_id"
export TWITCH_ACCESS_TOKEN="your_access_token"
export TWITCH_BROADCASTER_ID="your_broadcaster_id" # numeric user ID
To find your broadcaster ID:
curl -s -H "Authorization: Bearer $TWITCH_ACCESS_TOKEN" \
-H "Client-Id: $TWITCH_CLIENT_ID" \
https://api.twitch.tv/helix/users | python3 -c "import json,sys; print(json.load(sys.stdin)['data'][0]['id'])"