Skip to content

Commit 4353d51

Browse files
committed
[v5] update videos, descriptive function naming
1 parent dee877e commit 4353d51

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

resources/lib/twitch/api/v5/videos.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,26 @@
88

99

1010
@query
11-
def by_id(video_id):
12-
q = Qry('videos/{id}')
13-
q.add_urlkw(keys.ID, video_id)
11+
def get_video(video_id):
12+
q = Qry('videos/{video_id}')
13+
q.add_urlkw(keys.VIDEO_ID, video_id)
1414
return q
1515

1616

1717
@query
18-
def top(limit=10, offset=0, game=None, period=Period.WEEK):
18+
def get_top_videos(limit=10, offset=0, game=None, period=Period.WEEK, broadcast_type=BroadcastType.HIGHLIGHT):
1919
q = Qry('videos/top')
2020
q.add_param(keys.LIMIT, limit, 10)
2121
q.add_param(keys.OFFSET, offset, 0)
2222
q.add_param(keys.GAME, game)
2323
q.add_param(keys.PERIOD, Period.validate(period), Period.WEEK)
24+
q.add_param(keys.BROADCAST_TYPE, BroadcastType.validate(broadcast_type))
2425
return q
2526

2627

2728
# Needs Authentication
2829
@query
29-
def followed(limit=10, offset=0, broadcast_type=BroadcastType.HIGHLIGHT):
30+
def get_followed_videos(limit=10, offset=0, broadcast_type=BroadcastType.HIGHLIGHT):
3031
q = Qry('videos/followed')
3132
q.add_param(keys.LIMIT, limit, 10)
3233
q.add_param(keys.OFFSET, offset, 0)

resources/lib/twitch/keys.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,5 @@
7171
USER_AGENT_STRING = ('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) '
7272
'Gecko/20100101 Firefox/6.0')
7373
USER_ID = 'user_id'
74+
VIDEO_ID = 'video_id'
7475
VOD = 'vod'

0 commit comments

Comments
 (0)