Switch author type by icon type

This commit is contained in:
taizan-hokuto
2020-01-13 18:32:36 +09:00
parent 0272319fa6
commit 1643dd1ad1

View File

@@ -1,5 +1,4 @@
from datetime import datetime
class Author:
pass
class BaseRenderer:
@@ -60,6 +59,7 @@ class BaseRenderer:
def get_badges(self,renderer):
#print(json.dumps(renderer,ensure_ascii=False,indent=2))
isVerified = False
isChatOwner = False
isChatSponsor = False
@@ -67,16 +67,17 @@ class BaseRenderer:
badges=renderer.get("authorBadges")
if badges:
for badge in badges:
author_type = badge["liveChatAuthorBadgeRenderer"]["accessibility"]["accessibilityData"]["label"]
if author_type == '確認済み':
if badge["liveChatAuthorBadgeRenderer"].get("icon"):
author_type = badge["liveChatAuthorBadgeRenderer"]["icon"]["iconType"]
if author_type == 'VERIFIED':
isVerified = True
if author_type == '所有者':
if author_type == 'OWNER':
isChatOwner = True
if 'メンバー' in author_type:
if author_type == 'MODERATOR':
isChatModerator = True
if badge["liveChatAuthorBadgeRenderer"].get("customThumbnail"):
isChatSponsor = True
self.get_badgeurl(badge)
if author_type == 'モデレーター':
isChatModerator = True
return isVerified, isChatOwner, isChatSponsor, isChatModerator