Clips API does not expose video URL

I wrote a simple little Node.js downloader for people to put clip URLs in, and get the related clip video MP4 files out. 90% of the time, I can call the API, get the tracking_id and download using clips-media-assets.twitch.tv/[tracking-id].mp4

Occasionally, a clip is not at that address, but instead at [broadcast-id]-offset-######.mp4

There is no indication that a clip is at the alternate style URL, nor is the offset # exposed via the API in any way (occasionally the offset is also visible in the thumbnail URL, but not always).

If the Clip video file URL could be added to the API that would be ideal. Barring that, the fact that it’s using the broadcast_id with the offset would also work.

You can use a thumbnail image url to “generate” the video url.

For example:

“thumbnails”: {
“medium”: “https://clips-media-assets.twitch.tv/vod-107049351-offset-26-preview-480x272.jpg”,
“small”: “https://clips-media-assets.twitch.tv/vod-107049351-offset-26-preview-260x147.jpg”,
“tiny”: “https://clips-media-assets.twitch.tv/vod-107049351-offset-26-preview-86x45.jpg”
}

Just replace the “-preview-480x272.jpg” with “.mp4” and you got the video url.

2 Likes

I apologize, I meant to put the following in my initial report. I was able to solve a majority by looking for the offset in the Thumbnail. However, some clips do not expose the offset in the thumbnail URL. I didn’t know this was an issue until I got a bug report from a user with this Example Clip

Seems like Twitch just recently changed the format of the Clip video url again.

Looking at this API:

https://clips.twitch.tv/api/v2/clips/LazySuaveParrotBatChest/status

It now seems to be

https://clips-media-assets2.twitch.tv/AT-cm%7C{clip ID}.mp4

%7C is an url encoded “_”, not sure why they did it this way but that’s how it currently is.

Because Twitch now uses multiple ways for their video URLs it’s probably best to use the above mentioned API to get the right one for the Clip you want to download.

Thanks, that’ll work. While not ideal, as that API is deprecated and will be removed in December. But it’ll work in the meantime

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.