Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Condition if stream is on or off #675

Open
Trukess opened this issue Mar 6, 2017 · 7 comments
Open

Condition if stream is on or off #675

Trukess opened this issue Mar 6, 2017 · 7 comments

Comments

@Trukess
Copy link

Trukess commented Mar 6, 2017

I was reading the API documentation from twitch but didn't find what I needed, I just need a condition that give me true or false if streamer is on or off, someone can help me?

@freaktechnik
Copy link

You'll need https://dev.twitch.tv/docs/v5/reference/streams/.

Further this belongs to https://discuss.dev.twitch.tv and not an inactive bug tracker for obsolete API documentation.

@Trukess
Copy link
Author

Trukess commented Mar 6, 2017

Thank you very much for answer me freaktechnik, where I should type:

curl -H 'Accept: application/vnd.twitchtv.v5+json'
-H 'Client-ID: uo6dggojyb8d6soh92zknwmi5ej1q2'
-X GET 'https://api.twitch.tv/kraken/streams/?game=Overwatch'

What kind of language is this?

@scagood
Copy link

scagood commented Mar 18, 2017

curl is a command line tool. (https://curl.haxx.se/)

This means you'd put the following into your console:
f41ee468e886559c0a197610d5afb0cc

The top part is the command.
curl -H "Accept: application/vnd.twitchtv.v5+json" -H "Client-ID: uo6dggojyb8d6soh92zknwmi5ej1q2" -X GET "https://api.twitch.tv/kraken/streams/?game=Overwatch"
The next part is the response.

Broken down this gives you:
The application: curl
Add a header: -H "Accept: application/vnd.twitchtv.v5+json"
Add a header -H "Client-ID: uo6dggojyb8d6soh92zknwmi5ej1q2"
Set the request method: -X GET
Finally the url you're requesting: 'https://api.twitch.tv/kraken/streams/?game=Overwatch'

Hope this helps,
sca

@Trukess
Copy link
Author

Trukess commented Mar 18, 2017

Thanks for the answer scagood, so I need to install latest version from curl in my computer?

@freaktechnik
Copy link

No, that's just how the API documentation shows examples for making requests to the API. You can use whatever you want to make requests.

@Trukess
Copy link
Author

Trukess commented Mar 18, 2017

Oh I understand, thanks freaktechnik 🍡

@EpsilonAlpha
Copy link

EpsilonAlpha commented Jul 17, 2017

@freaktechnik to determine if a channel is online i proof that

".stream.viewers" is not NULL

and in my case if

".stream.stream_type" is "live"

so i skip out the Vodcasts.

Hopes that helps you.

Update:
Currently the v5 API returns if a stream is offline:
{
"stream": null
}

v3 version if a stream is offline
{
"stream": null,
"_links": {
"self": "https://api.twitch.tv/kraken/streams/",
"channel": "https://api.twitch.tv/kraken/channels/"
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants