teklynk / twitch_shoutout

Twitch Shout out command. !so channelname. This will display a random clip and say a shout out message in chat.
https://twitch-shoutout.pages.dev/
16 stars 3 forks source link

Twitch might have changed how URLs are generated for newer clips? #17

Open TianqiMikeHu opened 1 day ago

TianqiMikeHu commented 1 day ago

Just noticed the thumbnail format for newer clips have changed, which does appear to break this tool.

For example, if I use the tool with !watchclip https://clips.twitch.tv/SeductivePerfectClipsdadOneHand-QDHtFh3QBebzcPAV

The getuserclips.php API call returns an empty response (still 200 status code), which then causes the JavaScript console to throw an error like this:

shoutout.js?cachebus…E2eT6xL9aG2yB1f:300 Uncaught TypeError: Cannot read properties of undefined (reading 'clip_url') at shoutout.js?cachebus…T6xL9aG2yB1f:300:33 at xhrV.onreadystatechange (shoutout.js?cachebus…T6xL9aG2yB1f:230:17)


I don't really use this tool myself, but I just noticed my own implementation appears to be broken too, so I looked up some popular tools from a Google search to confirm whether other people's tools are affected too, which does seem to be the case.

For me, I just derive the clip URL from the thumbnail URL, I assume this tool has a similar approach? To demonstrate the difference, if I call Twitch's Get Clips API on the above clip, the thumbnail is:

"thumbnail_url": "https://static-cdn.jtvnw.net/twitch-clips-thumbnails-prod/SeductivePerfectClipsdadOneHand-QDHtFh3QBebzcPAV/b46f9699-bbd3-4b7f-96af-05b0bdaea68b/preview-480x272.jpg"

Compared to an older clip: https://clips.twitch.tv/OriginalEasyEndiveBloodTrail-r-MGj69BnciPyb1O

"thumbnail_url": "https://clips-media-assets2.twitch.tv/G5DtLq_jBo-vQZ3Ij8m9Tg/AT-cm%7CG5DtLq_jBo-vQZ3Ij8m9Tg-preview-480x272.jpg"


Unfortunately, I haven't been able to figure out any new workaround, so idk if there is a solution for this.

teklynk commented 1 day ago

This is also related to this issue for the clips player. https://github.com/teklynk/twitch_clips_player/issues/13

I was only able to skip/ignore clips that are using the new thumbnail url. However, I see this is an issue when using the !watchclip feature. The shoutouts should function as normal if the channel has older clips since those seem to still use the old thumbnail urls.

There is a discussion about this change/issue. Others are also dealing with the same thing. https://twitch.uservoice.com/forums/310213-developers/suggestions/39228784-extend-clips-api-to-provide-the-mp4-url-so-editors Hopefully Twitch adds a way of getting the clips mp4 for newer clips.

TianqiMikeHu commented 1 day ago

Got it, thanks for the quick response and the info! Well, good to know others are having the same issue with this change.