Channels

class twitch.api.channels.Channels

This class provides methods for easy access to Twitch Channels API.

classmethod get()

Gets a channel object based on the OAuth token.

>>> from twitch import TwitchClient
>>> client = TwitchClient('<my client id>', '<my oauth token>')
>>> channel = client.channels.get()
classmethod get_by_id(channel_id)

Gets a specified channel object.

Parameters:channel_id (string) – Channel ID
classmethod update(channel_id, status, game, delay, channel_feed_enabled)

Updates specified properties of a specified channel.

Parameters:
  • channel_id (string) – Channel ID
  • status (string) – Description of the broadcaster’s status.
  • game (string) – Name of game.
  • delay (int) – Channel delay, in seconds.
  • channel_feed_enabled (boolean) – If true, the channel’s feed is turned on.
classmethod get_editors(channel_id)

Gets a list of users who are editors for a specified channel.

Parameters:channel_id (string) – Channel ID
classmethod get_followers(channel_id, limit, offset, cursor, direction)

Gets a list of users who follow a specified channel.

Parameters:
  • channel_id (string) – Channel ID
  • limit (int) – Maximum number of objects to return. Default 25. Maximum 100.
  • offset (int) – Object offset for pagination of result. Default 0.
  • cursor (string) – Cursor of the next page.
  • direction (string) – Direction of sorting.
classmethod get_teams(channel_id)

Gets a list of teams to which a specified channel belongs.

Parameters:channel_id (string) – Channel ID
classmethod get_subscribers(channel_id, limit, offset, direction)

Gets a list of users subscribed to a specified channel.

Parameters:
  • channel_id (string) – Channel ID
  • limit (int) – Maximum number of objects to return. Default 25. Maximum 100.
  • offset (int) – Object offset for pagination of result. Default 0.
  • direction (string) – Direction of sorting.
classmethod check_subscription_by_user(channel_id, user_id)

Checks if a specified channel has a specified user subscribed to it.

Parameters:
  • channel_id (string) – Channel ID
  • user_id (string) – User ID
classmethod get_videos(channel_id, limit, offset, broadcast_type, language, sort)

Gets a list of videos from a specified channel.

Parameters:
  • channel_id (string) – Channel ID
  • limit (int) – Maximum number of objects to return. Default 10. Maximum 100.
  • offset (int) – Object offset for pagination of result. Default 0.
  • broadcast_type (string) – Constrains the type of videos returned.
  • language (string) – Constrains the language of the videos that are returned.
  • sort (string) – Sorting order of the returned objects.
classmethod start_commercial(channel_id, duration)

Starts a commercial (advertisement) on a specified channel.

Parameters:
  • channel_id (string) – Channel ID
  • duration (string) – Duration of the commercial in seconds. Default 30.
classmethod reset_stream_key(channel_id)

Deletes the stream key for a specified channel. Stream key is automatically reset.

Parameters:channel_id (string) – Channel ID
classmethod get_community(channel_id)

Gets the community for a specified channel.

Parameters:channel_id (string) – Channel ID
classmethod set_community(channel_id, community_id)

Sets a specified channel to be in a specified community.

Parameters:
  • channel_id (string) – Channel ID
  • community_id (string) – Community ID
classmethod delete_from_community(channel_id)

Deletes a specified channel from its community.

Parameters:channel_id (string) – Channel ID