videos - YoYoGames/GMEXT-Twitch GitHub Wiki
These are the functions of this module:
Twitch Endpoint: Get Videos
This function gets information about one or more published videos. You may get videos by ID, by user, or by game/category.
You may apply several filters to get a subset of the videos. The filters are applied as an AND operation to each video. For example, if language
is set to "de"
and game_id
is set to "21779"
, the response includes only videos that show playing League of Legends by users that stream in German. The filters apply only if you get videos by user ID or game ID.
This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.
Syntax:
twitch_videos_get_videos(id, user_id, game_id, optionals, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
id | String | A list of IDs that identify the videos you want to get. To get more than one video, include this parameter for each video you want to get. For example, id=1234&id=5678 . You may specify a maximum of 100 IDs. The endpoint ignores duplicate IDs and IDs that weren't found (if there's at least one valid ID).The id , user_id , and game_id parameters are mutually exclusive. |
user_id | String | The ID of the user whose list of videos you want to get. The id , user_id , and game_id parameters are mutually exclusive. |
game_id | String | A category or game ID. The response contains a maximum of 500 videos that show this content. To get category/game IDs, use the twitch_search_categories function.The id , user_id , and game_id parameters are mutually exclusive. |
optionals | Struct | The optional parameters to be passed into the function: - language : String : A filter used to filter the list of videos by the language that the video owner broadcasts in. For example, to get videos that were broadcast in German, set this parameter to the ISO 639-1 two-letter code for German (i.e., DE ). For a list of supported languages, see Supported Stream Language. If the language is not supported, use "other" . Specify this parameter only if you specify the game_id parameter.- period : String : A filter used to filter the list of videos by when they were published. For example, videos published in the last week. Possible values are: "all" , "day" , "month" , "week" . The default is "all" , which returns videos published in all periods. Specify this parameter only if you specify the game_id or user_id parameter.- sort : String : The order to sort the returned videos in. Possible values are: "time" — Sort the results in descending order by when they were created (i.e., latest video first), "trending" — Sort the results in descending order by biggest gains in viewership (i.e., highest trending video first), "views" — Sort the results in descending order by most views (i.e., highest number of views first). The default is "time" . Specify this parameter only if you specify the game_id or user_id parameter.- type : String : A filter used to filter the list of videos by the video's type. Possible case-sensitive values are: "all" , "archive" — On-demand videos (VODs) of past streams, "highlight" — Highlight reels of past streams, "upload" — External videos that the broadcaster uploaded using the Video Producer. The default is "all" , which returns all video types. Specify this parameter only if you specify the game_id or user_id parameter.- first : String : The maximum number of items to return per page in the response. The minimum page size is 1 item per page and the maximum is 100. The default is 20. Specify this parameter only if you specify the game_id or user_id parameter.- after : String : The cursor used to get the next page of results. The Pagination struct in the response contains the cursor's value. Read more. Specify this parameter only if you specify the user_id parameter.- before : String : The cursor used to get the previous page of results. The Pagination struct in the response contains the cursor's value. Read more. Specify this parameter only if you specify the user_id parameter. |
callback_success | Function | Triggered if the request succeeded |
callback_failed | Function | Triggered if the request failed |
Returns:
N/A
Triggers:
These members are returned in the success callback:
Member | Type | Description |
---|---|---|
data | Array | The list of published videos that match the filter criteria. |
├── id | String | An ID that identifies the video. |
├── stream_id | String | The ID of the stream that the video originated from if the video's type is "archive" ; otherwise, undefined . |
├── user_id | String | The ID of the broadcaster that owns the video. |
├── user_login | String | The broadcaster's login name. |
├── user_name | String | The broadcaster's display name. |
├── title | String | The video's title. |
├── description | String | The video's description. |
├── created_at | String | The date and time, in UTC, of when the video was created. The timestamp is in RFC3339 format. |
├── published_at | String | The date and time, in UTC, of when the video was published. The timestamp is in RFC3339 format. |
├── url | String | The video's URL. |
├── thumbnail_url | String | A URL to a thumbnail image of the video. Before using the URL, you must replace the %{width} and %{height} placeholders with the width and height of the thumbnail you want returned. Due to current limitations, ${width} must be 320 and ${height} must be 180. |
├── viewable | String | The video's viewable state. Always set to "public" . |
├── view_count | Real | The number of times that users have watched the video. |
├── language | String | The ISO 639-1 two-letter language code that the video was broadcast in. For example, the language code is "DE" if the video was broadcast in German. For a list of supported languages, see Supported Stream Language. The language value is "other" if the video was broadcast in a language not in the list of supported languages. |
├── type | String | The video's type. Possible values are: "archive" — An on-demand video (VOD) of one of the broadcaster's past streams, "highlight" — A highlight reel of one of the broadcaster's past streams. See Creating Highlights, "upload" — A video that the broadcaster uploaded to their video library. See Upload under Video Producer. |
├── duration | String | The video's length in ISO 8601 duration format. For example, 3m21s represents 3 minutes, 21 seconds. |
└── muted_segments | Array | The segments that Twitch Audio Recognition muted; otherwise, undefined . |
├── duration | Real | The duration of the muted segment, in seconds. |
└── offset | Real | The offset, in seconds, from the beginning of the video to where the muted segment begins. |
pagination | Struct | Contains the information used to page through the list of results. The struct is empty if there are no more pages left to page through. Read More |
└── cursor | String | The cursor used to get the next page of results. Use the cursor to set the request's after or before parameter depending on whether you're paging forwards or backwards through the results. |
This method is triggered on failure.
Twitch Endpoint: Delete Videos
This function deletes one or more videos. You may delete past broadcasts, highlights, or uploads.
Note
Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_CHANNEL_MANAGE_VIDEOS
.
This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.
Syntax:
twitch_videos_delete_videos(id, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
id | Real or Array | The list of videos to delete. To specify more than one video, pass an array with the ID of each video to delete. You can delete a maximum of 5 videos per request. Ignores invalid video IDs. If the user doesn't have permission to delete one of the videos in the list, none of the videos are deleted. |
callback_success | Function | Triggered if the request succeeded |
callback_failed | Function | Triggered if the request failed |
Returns:
N/A
Triggers:
These members are returned in the success callback:
Member | Type | Description |
---|---|---|
data | Array of String | The list of IDs of the videos that were deleted. |
This method is triggered on failure.