diff --git a/README.md b/README.md index a5769ac..e7bf6c1 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ async def main(): #other background operation here. await asyncio.sleep(3) -async def func(data) +async def func(data): for c in data.items: print(f"{c.datetime} [{c.author.name}]-{c.message} {c.amountString}") await data.tick_async() @@ -89,7 +89,30 @@ while chat.is_alive(): time.sleep(polling/len(data["items"])) ``` +### replay: +```python +from pytchat import ReplayChatAsync +import asyncio +async def main(): + chat = ReplayChatAsync("G1w62uEMZ74", seektime = 1000, callback = func) + while chat.is_alive(): + #other background operation here. + await asyncio.sleep(3) + +async def func(data): + for count in range(0,len(data.items)): + c= data.items[count] + if count!=len(data.items): + tick=data.items[count+1].timestamp -data.items[count].timestamp + else: + tick=0 + print(f"<{c.timestampText}> [{c.author.name}]-{c.message} {c.amountString}") + await asyncio.sleep(tick/1000) + +loop = asyncio.get_event_loop() +loop.run_until_complete(main()) +``` ## Chatdata Structure of Default Processor Structure of each item which got from items() function. @@ -122,7 +145,11 @@ Structure of each item which got from items() function. datetime str - + ex. "2019-10-10 12:34:56" + + timestampText + str + elapsed time. (ex. "1:02:27") amountValue @@ -137,7 +164,7 @@ Structure of each item which got from items() function. currency str - ISO 4217 currency codes (ex. "USD") + ISO 4217 currency codes (ex. "USD") bgColor diff --git a/pytchat/paramgen/liveparam.py b/pytchat/paramgen/liveparam.py index 83ea612..f53fdda 100644 --- a/pytchat/paramgen/liveparam.py +++ b/pytchat/paramgen/liveparam.py @@ -8,7 +8,7 @@ import urllib.parse Generate continuation parameter of youtube live chat. Author: taizan-hokuto (2019) @taizan205 -https://twitter.com/taizan205 + ver 0.0.1 2019.10.05 ''' def _gen_vid(video_id):