Videos - Get
Description
Gets video information by video ID (one or more), user ID (one only), or game ID (one only).
The response has a JSON payload with a data field containing an array of video elements. For lookup by user or game, pagination is available, along with several filters that can be specified as query string parameters.
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.
Method Definition
@RequestLine("GET /videos?id={id}&user_id={user_id}&game_id={game_id}&language={language}&period={period}&sort={sort}&type={type}&after={after}&before={before}&first={first}")
@Headers("Authorization: Bearer {token}")
HystrixCommand<VideoList> getVideos(
@Param("token") String authToken,
@Param("id") List<String> id,
@Param("user_id") String userId,
@Param("game_id") String gameId,
@Param("language") String language,
@Param("period") Video.SearchPeriod period,
@Param("sort") Video.SearchOrder sort,
@Param("type") Video.Type type,
@Param("first") Integer limit,
@Param("after") String after,
@Param("before") String before
);
Required Parameters (one of)
Name | Type | Description |
---|---|---|
id | string | ID of the video being queried. Limit: 100. If this is specified, you cannot use any of the optional query string parameters below. |
user_id | string | ID of the user who owns the video. |
game_id | string | ID of the game the video is of. |
Optional Parameters
Name | Type | Description |
---|---|---|
authToken | string | User or App Access Token. |
language | string | Language of the video being queried. Limit: 1. |
period | enum | Period during which the video was created. Valid values: "all", "day", "week", "month". Default: "all". |
sort | enum | Sort order of the videos. Valid values: "time", "trending", "views". Default: "time". |
type | enum | Type of video. Valid values: "all", "upload", "archive", "highlight". Default: "all". |
limit | integer | Maximum number of objects to return. Maximum: 100. Default: 20. |
after | string | Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query. |
before | string | Cursor for backward pagination: tells the server where to start fetching the next set of results, in a multi-page response. The cursor value specified here is from the pagination response field of a prior query. |
Code-Snippets
print videos
- Java
- Kotlin
- Groovy
VideoList resultList = twitchClient.getHelix().getVideos(null, null, "488552", null, null, null, null, null, 100, null, null).execute();
resultList.getVideos().forEach(video -> {
System.out.println(video.getId() + ": " + video.getTitle() + " - by: " + video.getUserName());
});
val resultList = twitchClient.helix.getVideos(null, null, "488552", null, null, null, null, null, 100, null, null).execute()
resultList.videos.forEach { video ->
println("${video.id}: ${video.title} - by: ${video.userName}")
}
def resultList = twitchClient.helix.getVideos(null, null, "488552", null, null, null, null, null, 100, null, null).execute()
resultList.videos.each { video ->
System.out.println "${video.id}: ${video.title} - by: ${video.userName}"
}