Merge branch 'feature/1' into develop

This commit is contained in:
taizan-hokuto
2019-11-22 00:16:20 +09:00
4 changed files with 23 additions and 6 deletions

View File

@@ -137,6 +137,11 @@ Structure of each item which got from items() function.
<td>str</td>
<td>emojis are represented by ":(shortcut text):"</td>
</tr>
<tr>
<td>messageEx</td>
<td>str</td>
<td>list of message texts and emoji URLs.</td>
</tr>
<tr>
<td>timestamp</td>
<td>int</td>
@@ -149,7 +154,7 @@ Structure of each item which got from items() function.
</tr>
<td>timestampText</td>
<td>str</td>
<td>elapsed time. (ex. "1:02:27")</td>
<td>elapsed time. (ex. "1:02:27") *Replay Only.</td>
</tr>
<tr>
<td>amountValue</td>
@@ -193,7 +198,7 @@ Structure of author object.
<tr>
<td>channelId</td>
<td>str</td>
<td></td>
<td>*chatter's channel ID. NOT broadcasting video's channel ID.</td>
</tr>
<tr>
<td>channelUrl</td>

View File

@@ -2,7 +2,7 @@
pytchat is a python library for fetching youtube live chat without using yt api, Selenium, or BeautifulSoup.
"""
__copyright__ = 'Copyright (C) 2019 taizan-hokuto'
__version__ = '0.0.3.1'
__version__ = '0.0.3.3'
__license__ = 'MIT'
__author__ = 'taizan-hokuto'
__author_email__ = '55448286+taizan-hokuto@users.noreply.github.com'

View File

@@ -36,9 +36,7 @@ class Parser:
raise NoContentsException('チャットデータを取得できませんでした。')
interval = self.get_interval(actions)
metadata.setdefault("timeoutMs",interval)
chatdata = []
for action in actions:
chatdata.append(action["replayChatItemAction"]["actions"][0])
chatdata = [action["replayChatItemAction"]["actions"][0] for action in actions]
return metadata, chatdata
def get_interval(self, actions: list):

View File

@@ -20,6 +20,7 @@ class BaseRenderer:
self.timestampText = ""
self.datetime = self.get_datetime(timestampUsec)
self.message = self.get_message(self.renderer)
self.messageEx = self.get_message_ex(self.renderer)
self.id = self.renderer.get('id')
self.amountValue= 0.0
self.amountString = ""
@@ -54,6 +55,19 @@ class BaseRenderer:
message += r.get('text','')
return message
def get_message_ex(self,renderer):
message = []
if renderer.get("message"):
runs=renderer["message"].get("runs")
if runs:
for r in runs:
if r:
if r.get('emoji'):
message.append(r['emoji']['image']['thumbnails'][1].get('url'))
else:
message.append(r.get('text',''))
return message
def get_badges(self,renderer):
isVerified = False
isChatOwner = False