Get a channel's videos?

Now I’ve searched through this. There’s billions of answers about this, but jesus christ somehow none of them worked.

Obviously I don’t want to specify an ID. I’m writing in bash and I want to make it the least painful as possible.

The consensus has mostly been: ?login=username

That seems to not work for videos https://i.imgur.com/NQJZHCE.png

To transcribe:

curl -H ‘Accept: application/vnd.twitchtv.v5+json’ \ davidv7@davidv7
-H ‘Client-ID: …’
-X GET ‘https://api.twitch.tv/kraken/channels?login=imaqtpie/videos

Obviously Client-ID is not empty. The response is complaining about lack of id.

Now the logic would be just to get a channel’s id. But how do I get it? I’ve been scouring through these threads about a billion times and it either wasn’t clear at all or it didn’t work. What should I be querying to just get videos. And a general question. What’s the point of having every example request be with an id? Maybe there’s a reason this was asked 5 billion times and keeps getting asked.

EDIT: I’m now aware I get a user id first throguh user?login=imaqtpie but investigating further there might be code issues there not sure will update

Firstly, regarding the use of ID over Username, the reason for ID being the preferred method is that it is a constant for a Twitch account, where as username can change over time. Some endpoints work with both username and ID’s, some just one or the other.

Next, before searching forums for an answer your first point of call should be the docs https://dev.twitch.tv/docs and the reason I mention this is because you seem to be mixing and matching parameters from different endpoints which is just leading to your confusion and why you’re not getting the results you intend.

For example you’re trying to use the v5 channel videos endpoint as documented here: https://dev.twitch.tv/docs/v5/reference/channels/#get-channel-videos but you’re using ?login= which is not a even valid parameter for that endpoint, furthermore you’re using it half way in the URL, querystring parameters should be at the end of the URL. You should be using https://api.twitch.tv/kraken/channels/<channel ID>/videos or the new Helix api endpoint https://api.twitch.tv/helix/videos which accepts the user_id param (as documented here: https://dev.twitch.tv/docs/api/reference/#get-videos)

As always, posting on a forum gave me superpowers and it all clicked like 10 seconds after I made the topic and the program is now fully functional. Thanks for the help

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