|
|
Riga 1: |
Riga 1: |
| Come capire se uno streamer è online / How to tell if a streamer is online:
| | [Online/Offline] |
| | |
| Dal sito / From the site: https://dev.twitch.tv/console/apps
| |
| | |
| 1. Creare l'applicazione / Create the application:
| |
| 2. Ottentere con il client id della applicazione e la sua chiave segreta / Get with the application's client id and its secret key:
| |
| 3. Con questi dati ottenere un token di autenticazione (attenzione che scade) / With this data obtain an authentication token (beware that it expires):
| |
| curl -d "client_id=***CLIENTID***&client_secret=***CLIENTSECRET***&grant_type=client_credentials" https://id.twitch.tv/oauth2/token
| |
| | |
| Esempio / Example:
| |
| | |
| curl -d "client_id=***CLIENTID***&client_secret=***CLIENTSECRET***&grant_type=client_credentials" https://id.twitch.tv/oauth2/token
| |
| {"access_token":"****TOKEN*****","expires_in":5050542,"token_type":"bearer"}
| |
| | |
| Esempio di Online / Example of Online:
| |
| | |
| curl -X GET 'https://api.twitch.tv/helix/streams?user_login=gazzinet' -H 'Authorization: Bearer ****TOKEN*****' -H 'Client-Id: ***CLIENTID***'
| |
| {"data":[{"id":"40095691464","user_id":"109028354","user_login":"gazzinet","user_name":"gazzinet","game_id":"509658","game_name":"Just Chatting","type":"live","title":"Si parla, si gioca .. si
| |
| legge.","viewer_count":0,"started_at":"2022-11-20T16:35:39Z","language":"it","thumbnail_url":"https://static-cdn.jtvnw.net/previews-ttv/live_user_gazzinet-{width}x{height}.jpg","tag_ids":null,"is_mature":false}],"pagination":{}}
| |
| | |
| Esempio di Offline / Example of Offline:
| |
| | |
| curl -X GET 'https://api.twitch.tv/helix/streams?user_login=gazzinet' -H 'Authorization: Bearer ****TOKEN*****' -H 'Client-Id: ***CLIENTID***'
| |
| {"data":[],"pagination":{}}
| |
| | |
| Thanks BarryCarlyon from https://discuss.dev.twitch.tv/t/check-online-offline/41970/2
| |