Getting the VOD timestamp from a clip

Is it possible to get the timestamp of the VOD from a clip?

There was a solution on a previous discussion but it no longer seems to work. Clip Event Timestamp

Works fine for me.

And I wrote what you linked to

Both the created_at timestamp is present as is the vod.offset keys (in the v5 output)

It didn’t work for me when I tried, unless I’m making a mistake somewhere

def clip(self):
    url = 'https://clips.twitch.tv/SpikyDelightfulDiscSSSsss'
    clip_id = re.sub(r'https://clips.twitch.tv/', '', url)
    clip_data = requests.get('https://api.twitch.tv/helix/clips?id=' + clip_id, headers=self.headers).json()
    clip_data2 = requests.get('https://api.twitch.tv/kraken/clips/' + clip_id, headers=self.headers).json()
    print(clip_data, '\n')
    print(clip_data2)

returns

{'data': [{'id': 'SpikyDelightfulDiscSSSsss', 'url': 'https://clips.twitch.tv/SpikyDelightfulDiscSSSsss', 'embed_url': 'https://clips.twitch.tv/embed?clip=SpikyDelightfulDiscSSSsss', 'broadcaster_id': '136765278', 'broadcaster_name': 'buddha', 'creator_id': '140875512', 'creator_name': 'yumbananas', 'video_id': '450418682', 'game_id': '32982', 'language': 'en', 'title': 'Curtis Hotmic', 'view_count': 6279, 'created_at': '2019-07-09T21:54:17Z', 'thumbnail_url': 'https://clips-media-assets2.twitch.tv/AT-cm%7C491840151-preview-480x272.jpg'}], 'pagination': {}} 

{'error': 'Not Found', 'status': 404, 'message': ''}

The 404 from the kraken endpoint is likely because you’re not specifying v5 when making the request, and so your request is defaulting to v3 (which doesn’t have that clips endpoint, hence the 404).

Add the Accept: application/vnd.twitchtv.v5+json header for that kraken request you’re making so that it’ll use v5 and correctly return data for the clip.

1 Like

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