Implement Superchat Calculator
This commit is contained in:
@@ -38,6 +38,9 @@ class Block:
|
||||
during_split : bool :
|
||||
whether this block is in the process of during_split.
|
||||
while True, this block is excluded from duplicate split procedure.
|
||||
|
||||
seektime : float :
|
||||
the last position of this block(seconds) already fetched.
|
||||
"""
|
||||
|
||||
__slots__ = ['first','last','end','continuation','chat_data','remaining',
|
||||
@@ -45,7 +48,7 @@ class Block:
|
||||
|
||||
def __init__(self, first = 0, last = 0, end = 0,
|
||||
continuation = '', chat_data = [], is_last = False,
|
||||
during_split = False,seektime = None):
|
||||
during_split = False, seektime = None):
|
||||
self.first = first
|
||||
self.last = last
|
||||
self.end = end
|
||||
|
||||
@@ -34,7 +34,6 @@ class DownloadWorker:
|
||||
self.video_id:str = video_id
|
||||
self.parent_block:Block = None
|
||||
|
||||
|
||||
async def run(self, session):
|
||||
while self.block.continuation:
|
||||
patch = await self.fetch(
|
||||
@@ -44,11 +43,3 @@ class DownloadWorker:
|
||||
self.block.done = True
|
||||
|
||||
|
||||
def fd(name,mes,src,patch,end):
|
||||
def offset(chats):
|
||||
if len(chats)==0:
|
||||
return None,None
|
||||
return parser.get_offset(chats[0]),parser.get_offset(chats[-1])
|
||||
|
||||
with open("v://tlog.csv",encoding="utf-8",mode="a") as f:
|
||||
f.write(f"WORKER,{name},mes,{mes},edge,{offset(src)[1]},first,{offset(patch)[0]},last,{offset(patch)[1]},end,{end}\n")
|
||||
|
||||
@@ -35,10 +35,7 @@ def parse(jsn):
|
||||
metadata = cont.get('liveChatReplayContinuationData')
|
||||
if metadata:
|
||||
continuation = metadata.get("continuation")
|
||||
#print(continuation)
|
||||
actions = contents['liveChatContinuation'].get('actions')
|
||||
# print(list(actions[0]['replayChatItemAction']["actions"][0].values()
|
||||
# )[0]['item'].get("liveChatPaidMessageRenderer"))
|
||||
if continuation:
|
||||
return continuation, [action["replayChatItemAction"]["actions"][0]
|
||||
for action in actions
|
||||
|
||||
Reference in New Issue
Block a user