Implement 'topchat_only' parameter

: make it possible to select whether to get only top chat.
This commit is contained in:
taizan-hokuto
2020-01-11 04:22:48 +09:00
parent 404623546e
commit ff1ee70d7e
4 changed files with 29 additions and 14 deletions

View File

@@ -52,8 +52,8 @@ def _nval(val):
buf += val.to_bytes(1,'big')
return buf
def _build(video_id, seektime, topchatonly = False):
switch_01 = b'\x04' if topchatonly else b'\x01'
def _build(video_id, seektime, topchat_only):
switch_01 = b'\x04' if topchat_only else b'\x01'
if seektime < 0:
times =_nval(0)
switch = b'\x04'
@@ -102,12 +102,14 @@ def _build(video_id, seektime, topchatonly = False):
).decode()
)
def getparam(video_id, seektime = 0):
def getparam(video_id, seektime = 0, topchat_only = False):
'''
Parameter
---------
seektime : int
unit:seconds
start position of fetching chat data.
topchat_only : bool
if True, fetch only 'top chat'
'''
return _build(video_id, seektime)
return _build(video_id, seektime, topchat_only)