Skip to content

SurajBhari/streamsnip

Repository files navigation

Streamsnip/Clip_nightbot: Stream Clipping Simplified

Status Streamsnip StreamsnipClipsPerformance Streamsnip Test page
Tech Stack
Chart.js Bootstrap
Python Flask
JavaScript CSS3
Apache AWS
YouTube Youtube Gaming

License: CC BY-NC-ND 4.0
You can view additional details on this page

The primary goal of streamsnip is to streamline the clipping process, addressing challenges faced by one of my favorite streamers. Here's how you can make the most of it:

Monetization

This program is a free for everyone as of now. But you can contribute.
Buy Me A Coffee
Most of the donations goes back to development and hosting costing.

Nightbot Command:

!addcom !clip $(urlfetch https://streamsnip.com/clip/$(chatid)/$(querystring)?delay=-40)

Just adding this command will get you started. but if you want to have a discord message. or customization then read below.
this is the most famous way of using it. Simply copy paste this in your chat.

Nightbot panel way

Go to Nightbot Dashboard and add command like this
image

If you want to send a discord message. then I would need to add a webhook URL alongside the youtube channel ID. for that fill this form or contact me here.

Contact Discord
Discord Badge Server Badge

Optional Arguments:

  • showlink (default: true) - Display the link where all clips can be viewed.
  • screenshot (default: false) - Enable or disable screenshot capture. If enabled the nightbot may not get response in given time and will say "Timed out" message. but it will still clip.
  • delay (default: 0) - Introduce an artificial delay to the command. Useful for scheduling links in the future or past.
  • force_desc (default: false) - if set to true will deny any clip that doesn't have a title (description as its called in backend). please ensure that your viewers know this is the case. else you will miss out on a lot of clips
    image
  • silent (default: 2||Highest) - Level of the clipping message. see example below.
    image
  • private (default: false) - If set to true. the clips made are not shown on the web nor impact stats. if you don't want your channel to show up on website. you use it. This override silent and returns just ​​clipped 😉
    image
  • webhook (default: None) - You can provide your own webhook URL instead of the one provided earlier (if you did). By combining this with private, you can create completely anonymous clips in a private channel.

To use your webhook URL, it should be in the format of webhook_id/webhook_token. For example, if your webhook URL is:

https://discord.com/api/webhooks/1211440693168447599/ieU15QcFI_PcAun88TFGpUuRMK6E7Me14jioxB1mbJrRU6ay3XI8jByeEk3XKlVKr8_s

You would pass webhook=1211440693168447599/ieU15QcFI_PcAun88TFGpUuRMK6E7Me14jioxB1mbJrRU6ay3XI8jByeEk3XKlVKr8_s as the argument.

  • message_level (default: 0) - Customize how the discord message should look like. to support "anonymity" image

  • take_delays (default: false) - Do you consider your viewers to be smarter than average person ? if you turn this on. the first and last word will be evaluted to add/subtract delay. The following screenshot was taken with delay=0. but it still gave a delay of 20 seconds as the author wrote -20 as first word.
    Remember. this doesn't Override the delay parameter. it only add the delay. so if you had -40 in delay arg. then delay in the below example would be -60. and not -40.

    image

Here's one example using all of it.

❌THIS IS PROBABLY NOT WHAT YOU WANT TO TYPE IN YOUR CHAT. ITS TOO BIG. use the one above.❌

https://streamsnip.com/clip/$(chatid)/$(querystring)?showlink=false&screenshot=true&delay=-30&private=true&webhook=1211440693168447599/ieU15QcFI_PcAun88TFGpUuRMK6E7Me14jioxB1mbJrRU6ay3XI8jByeEk3XKlVKr8_s&message_level=3&take_delays=true

Examples:

  • https://streamsnip.com/clip/$(chatid)/$(querystring)?showlink=false - No links.
  • https://streamsnip.com/clip/$(chatid)/$(querystring)?showlink=false&screenshot=true - No links, but with screenshots.
  • https://streamsnip.com/clip/$(chatid)/$(querystring)?screenshot=true - Screenshots are given.
  • https://streamsnip.com/clip/$(chatid)/$(querystring)?delay=-20 - Set a delay in the past by 20 seconds.

Other Commands

  1. !delete <clip_id> - delete the given clip(s)
!addcom !delete $(urlfetch https://streamsnip.com/delete/$(query)) -ul=moderator

⚠️ don't remove the -ul=moderator part, otherwise anyone can delete your clips.
image image

  • silent (default: 2||Highest) - Level of returning message. 0 - no message. 1 - clip id(s) that was/were deleted. else no change.

  1. !edit <clip_id> <new_title> - edit the title of the given clip
!addcom !edit $(urlfetch https://streamsnip.com/edit/$(querystring)) -ul=moderator

⚠️ don't remove the -ul=moderator part, otherwise anyone can edit your clips.
image

  • silent (default: 2||Highest) - Level of returning message. 0 - no message. 1 - clip id that was edited. else no change.

  1. !clips or !export - gives link where you can see all the clips
!addcom !export $(urlfetch https://streamsnip.com/export)

image


  1. !search gives the last clip that had the query in in it.
 !addcom !search $(urlfetch https://streamsnip.com/search/$(querystring))

Args

level - (default: 0) - What level of answer you want. Here's a screenshot that showcase it. image


  1. !uptime gives uptime of the latest stream of the channel that called this command
 !addcom !uptime $(urlfetch https://streamsnip.com/uptime)

Args

level - (default: 0) - What level of answer you want. Here's a screenshot that showcase it.

image


  1. !recent gives last 5 clip details in chat. in format of | <clip_id> <description> |
 !addcom !recent $(urlfetch https://streamsnip.com/recent?count=$(1))

Args

count - (default: 5) - How many records you want.
image


  1. !clipstats gives a brief stats of number of clips in the chat. total and by the user who ran the command.
 !addcom !clipstats $(urlfetch https://streamsnip.com/nstats)

image


Super Advanced, Proceed with caution here

Click me to open advanced options.

Idea from here, You can combine !search command to give out timestamp to particular events in the stream
A combo can look like this

!addcom !clipkill $(urlfetch https://streamsnip.com/clip/$(chatid)/kill-automated)
!addcom !lastkill $(urlfetch https://streamsnip.com/search/kill-automated)

Want more advanced ? here
There is one more endpoint named /searchx/<clip-desc> that returns JSON of the clip with that clip-desc.
THIS IS JUST 1 EXAMPLE. SKY IS THE LIMIT HERE

!addcom !lastkilltime $(eval clip=$(urlfetch json https://streamsnip.com/searchx/kill-automated); clip['hms'])

returning data looks something like this
carbon (3)

  1. !streaminfo this gives streaminfo in JSON format that you can use to do some other stuff. data looks something like this. carbon

    Route is at /stream_info

    !addcom !myid $(eval info=$(urlfetch json https://streamsnip.com/stream_info); info['author_id'])

Self Hosting

I made it quite easy to host yourself. if you prefer that way.

Installation

  1. Clone the repo
  2. Install requirements - pip install -r requirements.txt
  3. (Optional) Install ffmpeg and ytdlp for screenshot to work.
  4. CONFIG - edit config.sample.json to config.json and insert few keys in it. password to use at /admin page and /add route.

Running

  1. Run by doing. python main.py
  2. (Optional) You can run. helper/maintainer.py. for this you will need management_webhook in config.json to send you backup and logs to your discord.
  3. For nightbot. you need to replace streamsnip.com to your ip. and use http instead of https.

Additional Customization:

  1. You can use -ul=userlevel to limit clipping to specific user levels (e.g., mods). Find user levels here to reduce spam and grant clipping access to specific individuals.

  2. You can add a timer from here. to remind users to clip moments regularly
    Ex.

​Saw something amazing ⭐? Type !clip to clip it and ship it 📩to Discord. (Also add a useful title too after the command (Optional but Preferred))