Auto Twitch Clip Scanner

Description

This extension will run once per minute using the Present Viewers trigger to check for any new clips created within the scan interval. If any new clips are found, then a custom New Twitch Clip Found event will be triggered. Also included: a !clip command to create a clip via Chat and post to Chat/Discord, using this command will avoid the New Twitch Clip Found event from being triggered multiple times.

Import Code

twitchClipScanner_v2.0.1.sb (15.7 KB)

Installation

  1. Download the import code file
  2. Click the Import button to open the Import dialog
  3. Drag and drop the twitchClipScanner.sb file into the Import String box and then click Import

Configuration

Posting clips only if title is unique

  • Set postUniqueTitlesOnly to True if you only want to post clips that have a title that is different from the channel title

The two settings below use the following syntax for time spans:

Postfix Symbol Usage Explanation
d 4d 4 days
h 4d3h 4 days, 3 hours
m 4d3h2m 4 days, 3 hours, 2 minutes
s 4d3h2m1s 4 days, 3 hours, 2 minutes, 1 second

Scan Clips Interval

  • The scanClipsWithinLast argument is the time span of how far back you want to scan clips for
    • This is set by default to 30d, or 30 days
    • If you have a lot of clips, you may want to shorten the scan time span interval

Post Clips Interval

  • The postClipsWithinLast argument is the time span of which clips you want to post if found
    • This is set by default to 1d, or 1 day, meaning any clips found within the past day will trigger the New Twitch Clip Found event
    • Make sure this time span is shorter than the Scan Clips Interval

New Twitch Clip Found

This is an example action that uses the New Twitch Clip Found Custom Trigger. It will be triggered if new Twitch clips are found. The trigger will populate the following variables:

Variable List

Variable Name Explanation
%clipId% An ID that uniquely identifies the clip.
%clipUrl% A URL to the clip.
%clipEmbedUrl% A URL that you can use in an iframe to embed the clip
%clipCreatorId% An ID that identifies the user that created the clip.
%clipCreatorUserName% The user’s display name.
%clipVideoId% An ID that identifies the video that the clip came from. This field contains an empty string if the video is not available.
%clipGameId% The ID of the game that was being played when the clip was created.
%clipGameTitle% Title of the clip category
%clipGameArtUrl% A URL to a thumbnail for the clip category
%clipLanguage% The ISO 639-1 two-letter language code that the broadcaster broadcasts in. For example, en for English. The value is other if the broadcaster uses a language that Twitch doesn’t support.
%clipTitle% The title of the clip.
%clipCreatedAt% The date and time of when the clip was created. The date and time is in RFC3339 format.
%clipThumbnailUrl% A URL to a thumbnail image of the clip.
%clipDuration% The length of the clip, in seconds.
%clipIsFeatured% A Boolean value that indicates if the clip is featured or not.
  • By default, a Twitch Chat Message subaction will read:
%clipCreatorUserName% created a clip with title '%clipTitle%': %clipUrl%
  • You may also use something like a Discord Basic Webhook subaction to post the clip in a #twitch-clips channel on your community Discord server

6 Likes

v1.0.1 - added an option postUniqueTitlesOnly to post only if the clip title is different from the channel title

v1.0.2 - added option for logging to a set of json files for debugging purposes

v1.0.6 - After some debugging, I think I can get some consistent results. I’ve cleaned up the logging code. If you need any logging, test the Test Trigger.

1 Like

v1.0.7 - Fixed a bug preventing a clip from posting to discord

v1.0.8 - Fixed another silly bug

1 Like

v2.0.1 - Updated the extension to just trigger a New Twitch Clip Found event when a new Twitch Clip is found. Much easier to set up

This is what I was looking for ! :heart:

is it possible to get stream title? or am I missing something

Stream Title? Independent of the %clipTitle% variable? That can be done by adding a Get User Info for Target, setting it to Broadcaster, and then using the %targetChannelTitle% variable

I was looking for stream title. Oh thanks that worked :smile:

Stream Title? Independent of the %clipTitle% variable? That can be done by adding a Get User Info for Target, setting it to Broadcaster, and then using the %targetChannelTitle% variable

Screenshot 2024-02-19 211057

The stream title wont work even though I did as you said!
this is the screenshot of the SB :point_down:
Screenshot 2024-02-19 211742

Can you tell what am I doing wrong?
coz %targetChannelTitle% wont work.

image
Looks like you used the wrong subaction. Twitch > User > Get User Info for Target and set it to Broadcaster, then move that subaction to the top.

Ye its showing the stream title now !
Thanks for the help ! :heart: