def get_videos(self, channel_id, limit=10, offset=0, broadcast_type=BROADCAST_TYPE_HIGHLIGHT, language=None, sort=VIDEO_SORT_TIME): if limit > 100: raise TwitchAttributeException( 'Maximum number of objects returned in one request is 100') if broadcast_type not in BROADCAST_TYPES: raise TwitchAttributeException( 'Broadcast type is not valid. Valid values are {}'.format(BROADCAST_TYPES)) if sort not in VIDEO_SORTS: raise TwitchAttributeException( 'Sort is not valid. Valid values are {}'.format(VIDEO_SORTS) ) params = { 'limit': limit, 'offset': offset, 'broadcast_type': broadcast_type, 'sort': sort } if language is not None: params['language'] = language response = self._request_get('channels/{}/videos'.format(channel_id), params=params) return [Video.construct_from(x) for x in response['videos']]
def get_top(self, limit=10, offset=0, game=None, period=PERIOD_WEEK, broadcast_type=BROADCAST_TYPE_HIGHLIGHT): if limit > 100: raise TwitchAttributeException( 'Maximum number of objects returned in one request is 100') if period not in PERIODS: raise TwitchAttributeException( 'Period is not valid. Valid values are %s' % PERIODS) if broadcast_type not in BROADCAST_TYPES: raise TwitchAttributeException( 'Broadcast type is not valid. Valid values are %s' % BROADCAST_TYPES) params = { 'limit': limit, 'offset': offset, 'game': game, 'period': period, 'broadcast_type': ','.join(broadcast_type) } response = self._request_get('videos/top', params=params) return [Video.construct_from(x) for x in response['vods']]
def get_top( self, limit=10, offset=0, game=None, period=PERIOD_WEEK, broadcast_type=BROADCAST_TYPE_HIGHLIGHT, ): if limit > 100: raise TwitchAttributeException( "Maximum number of objects returned in one request is 100") if period not in PERIODS: raise TwitchAttributeException( "Period is not valid. Valid values are {}".format(PERIODS)) if broadcast_type not in BROADCAST_TYPES: raise TwitchAttributeException( "Broadcast type is not valid. Valid values are {}".format( BROADCAST_TYPES)) params = { "limit": limit, "offset": offset, "game": game, "period": period, "broadcast_type": ",".join(broadcast_type), } response = self._request_get("videos/top", params=params) return [Video.construct_from(x) for x in response["vods"]]
def get_videos( self, channel_id, limit=10, offset=0, broadcast_type=BROADCAST_TYPE_HIGHLIGHT, language=None, sort=VIDEO_SORT_TIME, ): if limit > 100: raise TwitchAttributeException( "Maximum number of objects returned in one request is 100") if broadcast_type not in BROADCAST_TYPES: raise TwitchAttributeException( "Broadcast type is not valid. Valid values are {}".format( BROADCAST_TYPES)) if sort not in VIDEO_SORTS: raise TwitchAttributeException( "Sort is not valid. Valid values are {}".format(VIDEO_SORTS)) params = { "limit": limit, "offset": offset, "broadcast_type": broadcast_type, "sort": sort, } if language is not None: params["language"] = language response = self._request_get("channels/{}/videos".format(channel_id), params=params) return [Video.construct_from(x) for x in response["videos"]]
def get_followed_videos(self, limit=10, offset=0, broadcast_type=BROADCAST_TYPE_HIGHLIGHT): if limit > 100: raise TwitchAttributeException( 'Maximum number of objects returned in one request is 100') if broadcast_type not in BROADCAST_TYPES: raise TwitchAttributeException( 'Broadcast type is not valid. Valid values are {}'.format(BROADCAST_TYPES)) params = { 'limit': limit, 'offset': offset, 'broadcast_type': broadcast_type } response = self._request_get('videos/followed', params=params) return [Video.construct_from(x) for x in response['videos']]
def get_followed_videos( self, limit=10, offset=0, broadcast_type=BROADCAST_TYPE_HIGHLIGHT ): if limit > 100: raise TwitchAttributeException( "Maximum number of objects returned in one request is 100" ) if broadcast_type not in BROADCAST_TYPES: raise TwitchAttributeException( "Broadcast type is not valid. Valid values are {}".format( BROADCAST_TYPES ) ) params = {"limit": limit, "offset": offset, "broadcast_type": broadcast_type} response = self._request_get("videos/followed", params=params) return [Video.construct_from(x) for x in response["videos"]]
def get_by_id(self, video_id): response = self._request_get('videos/{}'.format(video_id)) return Video.construct_from(response)
def get_by_id(self, video_id): response = self._request_get('videos/%s' % video_id) return Video.construct_from(response)