Update README

This commit is contained in:
taizan-hokuto
2019-11-14 01:35:06 +09:00
parent 0aa45109a5
commit 76f41bbd59
2 changed files with 31 additions and 4 deletions

View File

@@ -62,7 +62,7 @@ async def main():
#other background operation here. #other background operation here.
await asyncio.sleep(3) await asyncio.sleep(3)
async def func(data) async def func(data):
for c in data.items: for c in data.items:
print(f"{c.datetime} [{c.author.name}]-{c.message} {c.amountString}") print(f"{c.datetime} [{c.author.name}]-{c.message} {c.amountString}")
await data.tick_async() await data.tick_async()
@@ -89,7 +89,30 @@ while chat.is_alive():
time.sleep(polling/len(data["items"])) 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 ## Chatdata Structure of Default Processor
Structure of each item which got from items() function. Structure of each item which got from items() function.
@@ -122,7 +145,11 @@ Structure of each item which got from items() function.
<tr> <tr>
<td>datetime</td> <td>datetime</td>
<td>str</td> <td>str</td>
<td></td> <td>ex. "2019-10-10 12:34:56"</td>
</tr>
<td>timestampText</td>
<td>str</td>
<td>elapsed time. (ex. "1:02:27")</td>
</tr> </tr>
<tr> <tr>
<td>amountValue</td> <td>amountValue</td>
@@ -137,7 +164,7 @@ Structure of each item which got from items() function.
<tr> <tr>
<td>currency</td> <td>currency</td>
<td>str</td> <td>str</td>
<td>ISO 4217 currency codes (ex. "USD")</td> <td><a href="https://en.wikipedia.org/wiki/ISO_4217">ISO 4217 currency codes</a> (ex. "USD")</td>
</tr> </tr>
<tr> <tr>
<td>bgColor</td> <td>bgColor</td>

View File

@@ -8,7 +8,7 @@ import urllib.parse
Generate continuation parameter of youtube live chat. Generate continuation parameter of youtube live chat.
Author: taizan-hokuto (2019) @taizan205 Author: taizan-hokuto (2019) @taizan205
https://twitter.com/taizan205
ver 0.0.1 2019.10.05 ver 0.0.1 2019.10.05
''' '''
def _gen_vid(video_id): def _gen_vid(video_id):