Last 6 Clips on my Website


#1

Hello, everybody,

how can I display the last 6 clips from my channel on my website?

Thank you very much for your cooperation.

With best regards,
Vakarian


#2

The clips API is documented here

So you just do a call speicifing your broadcaster_id with first set to 6

And then pass the clip ID’s to the embed logic (or just use a dumb iframe on the embed_url key)


#3

That won’t work, helix clips are ordered by popularity so first=6 would just give you the all time most popular clips.

You would have to make a time based request with started_at and ended_at to get all clips in the last week or so and then just sort all the clips by created_at and take the latest ones.

This will still be missing some clips however because the Clips API is broken (Issue) and won’t give you all clips in a time range, even in small ones with barely any clips.

The best way to actually get all clips in the last week would be to do multiple time range requests, like one for all clips in the last week, one for all clips in the last two weeks, and one separate one for each day, then combine all the results to hopefully get most clips in the time range you want without missing too many. Be sure to get all clips in each range until there’s no more pagination token!

Another thing is that a clip’s created_at value is based on when the user made the clip not when the content in the clip happened so if someone recently clipped a 2 months old VOD that might be the latest clip based on created_at. Fixing that will be a bit more annoying.

Have fun using Twitch’s Clips API :+1:


#4

Why would you want your last 6 clips displayed on your website?
Imagine someone create 6 clips in a row, without anything interesting in it, this will just ruin the interest of this part of your website.

Getting the 6 most popular clips would be better to engage visitors :slight_smile: