Skip to main content

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)

NameTypeDescription
idstringID of the video being queried. Limit: 100. If this is specified, you cannot use any of the optional query string parameters below.
user_idstringID of the user who owns the video.
game_idstringID of the game the video is of.

Optional Parameters

NameTypeDescription
authTokenstringUser or App Access Token.
languagestringLanguage of the video being queried. Limit: 1.
periodenumPeriod during which the video was created. Valid values: "all", "day", "week", "month". Default: "all".
sortenumSort order of the videos. Valid values: "time", "trending", "views". Default: "time".
typeenumType of video. Valid values: "all", "upload", "archive", "highlight". Default: "all".
limitintegerMaximum number of objects to return. Maximum: 100. Default: 20.
afterstringCursor 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.
beforestringCursor 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

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());
});