예제 #1
0
def get_top(after='MA==', before='MA==', first=20, use_app_token=False):
    q = Qry('games/top', use_app_token=use_app_token)
    q.add_param(keys.AFTER, Cursor.validate(after), 'MA==')
    q.add_param(keys.BEFORE, Cursor.validate(before), 'MA==')
    q.add_param(keys.FIRST, first, 20)

    return q
def get_comments(channel_id, post_id, limit=10, cursor='MA=='):
    q = Qry('feed/{channel_id}/posts/{post_id}/comments')
    q.add_urlkw(keys.CHANNEL_ID, channel_id)
    q.add_urlkw(keys.POST_ID, post_id)
    q.add_param(keys.LIMIT, limit, 10)
    q.add_param(keys.CURSOR, Cursor.validate(cursor), 'MA==')
    return q
def get_posts(channel_id, limit=10, cursor='MA==', comments=5):
    q = Qry('feed/{channel_id}/posts')
    q.add_urlkw(keys.CHANNEL_ID, channel_id)
    q.add_param(keys.LIMIT, limit, 10)
    q.add_param(keys.CURSOR, Cursor.validate(cursor), 'MA==')
    q.add_param(keys.COMMENTS, comments, 5)
    return q
예제 #4
0
def get_collections(channel_id, limit=10, cursor='MA==', containing_item=None):
    q = Qry('channels/{channel_id}/collections', use_token=False)
    q.add_urlkw(keys.CHANNEL_ID, channel_id)
    q.add_param(keys.LIMIT, limit, 10)
    q.add_param(keys.CURSOR, Cursor.validate(cursor), 'MA==')
    q.add_param(keys.CONTAINING_ITEM, containing_item,
                None)  # 'video:<video_id>'
    return q
예제 #5
0
def get_followed(trending=Boolean.FALSE,
                 language=Language.ALL,
                 cursor='MA==',
                 limit=10):
    q = Qry('clips/followed')
    q.add_param(keys.TRENDING, Boolean.validate(trending), Boolean.FALSE)
    q.add_param(keys.LANGUAGE, Language.validate(language), Language.ALL)
    q.add_param(keys.LIMIT, limit, 10)
    q.add_param(keys.CURSOR, Cursor.validate(cursor), 'MA==')
    return q
예제 #6
0
def get_metadata(community_id=list(), game_id=list(), user_id=list(),
                 user_login=list(), stream_type=StreamTypeHelix.ALL, language=list(),
                 after='MA==', before='MA==', first=20, use_app_token=False):
    q = Qry('streams/metadata', use_app_token=use_app_token)
    q.add_param(keys.AFTER, Cursor.validate(after), 'MA==')
    q.add_param(keys.BEFORE, Cursor.validate(before), 'MA==')
    q.add_param(keys.FIRST, first, 20)
    q.add_param(keys.COMMUNITY_ID, community_id, list())
    q.add_param(keys.GAME_ID, game_id, list())
    q.add_param(keys.USER_ID, user_id, list())
    q.add_param(keys.USER_LOGIN, user_login, list())
    q.add_param(keys.TYPE, StreamTypeHelix.validate(stream_type), StreamTypeHelix.ALL)
    if isinstance(language, list):
        _language = [lang for lang in language if lang in Language.valid()]
        q.add_param(keys.LANGUAGE, _language, list())
    else:
        q.add_param(keys.LANGUAGE, Language.validate(language), '')

    return q
예제 #7
0
def get_followers(channel_id,
                  limit=25,
                  offset=0,
                  cursor='MA==',
                  direction=Direction.DESC):
    q = Qry('channels/{channel_id}/follows')
    q.add_urlkw(keys.CHANNEL_ID, channel_id)
    q.add_param(keys.LIMIT, limit, 25)
    q.add_param(keys.OFFSET, offset, 0)
    q.add_param(keys.CURSOR, Cursor.validate(cursor), 'MA==')
    q.add_param(keys.DIRECTION, direction, Direction.DESC)
    return q
예제 #8
0
def get_top(channels=None,
            games=None,
            period=ClipPeriod.WEEK,
            trending=Boolean.FALSE,
            language=Language.ALL,
            cursor='MA==',
            limit=10):
    q = Qry('clips/top')
    q.add_param(keys.CHANNEL, channels, None)
    q.add_param(keys.GAME, games, None)
    q.add_param(keys.PERIOD, ClipPeriod.validate(period), ClipPeriod.WEEK)
    q.add_param(keys.TRENDING, Boolean.validate(trending), Boolean.FALSE)
    q.add_param(keys.LANGUAGE, Language.validate(language), Language.ALL)
    q.add_param(keys.LIMIT, limit, 10)
    q.add_param(keys.CURSOR, Cursor.validate(cursor), 'MA==')
    return q
def get_bans(community_id, limit=10, cursor='MA=='):
    q = Qry('communities/{community_id}/bans')
    q.add_urlkw(keys.COMMUNITY_ID, community_id)
    q.add_param(keys.LIMIT, limit, 10)
    q.add_param(keys.CURSOR, Cursor.validate(cursor), 'MA==')
    return q
def get_top(limit=10, cursor='MA=='):
    q = Qry('communities/top')
    q.add_param(keys.LIMIT, limit, 10)
    q.add_param(keys.CURSOR, Cursor.validate(cursor), 'MA==')
    return q