Improve comments UI
Adds author like and sytles better
This commit is contained in:
parent
ea184ef316
commit
ed055be0b5
@ -3,23 +3,28 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
{% if comment.authorIsChannelOwner %}
|
{% if comment.authorIsChannelOwner %}
|
||||||
|
|
||||||
<a class="author" href="{{comment.channel}}"><i class="red user circle icon"></i>{{comment.author}}</a>
|
<a class="author" style="color: red;" href="{{comment.channel}}"><i class="red user circle icon"></i>{{comment.author}}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="author" href="{{comment.channel}}">{{comment.author}}</a>
|
<a class="author" href="{{comment.channel}}">{{comment.author}}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="metadata">
|
<div class="metadata">
|
||||||
<div class="date">{{comment.date}}</div>
|
<div class="date">{{comment.date}}</div>
|
||||||
<div class="rating">
|
|
||||||
<i class="thumbs up icon"></i>
|
|
||||||
{{comment.likes}}
|
|
||||||
</div>
|
</div>
|
||||||
<div class="rating">
|
<div class="text">
|
||||||
<i class="comment icon"></i>
|
{{comment.text}}
|
||||||
{{comment.replies}}
|
</div>
|
||||||
|
<div class="metadata">
|
||||||
|
<div class="rating">
|
||||||
|
<i class="comment icon"></i>
|
||||||
|
{{comment.replies}}
|
||||||
|
</div>
|
||||||
|
<div class="rating">
|
||||||
|
<i class="thumbs up icon"></i>
|
||||||
|
{{comment.likes}}
|
||||||
|
</div>
|
||||||
|
{%if comment.creatorHeart != false%}
|
||||||
|
<i class="small red heart icon"></i><img class="ui circular image" style="width: 15px; height: 15px;" src="{{comment.creatorHeart}}">
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="text">
|
|
||||||
{{comment.text}}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -82,6 +82,7 @@ def concat_texts(strings):
|
|||||||
|
|
||||||
def parse_comment(raw_comment):
|
def parse_comment(raw_comment):
|
||||||
cmnt = {}
|
cmnt = {}
|
||||||
|
print(raw_comment)
|
||||||
raw_comment = raw_comment['commentThreadRenderer']['comment']['commentRenderer']
|
raw_comment = raw_comment['commentThreadRenderer']['comment']['commentRenderer']
|
||||||
imgHostName = urllib.parse.urlparse(raw_comment['authorThumbnail']['thumbnails'][0]['url']).netloc
|
imgHostName = urllib.parse.urlparse(raw_comment['authorThumbnail']['thumbnails'][0]['url']).netloc
|
||||||
cmnt['author'] = raw_comment['authorText']['runs'][0]['text']
|
cmnt['author'] = raw_comment['authorText']['runs'][0]['text']
|
||||||
@ -89,6 +90,11 @@ def parse_comment(raw_comment):
|
|||||||
cmnt['channel'] = raw_comment['authorEndpoint']['commandMetadata']['webCommandMetadata']['url']
|
cmnt['channel'] = raw_comment['authorEndpoint']['commandMetadata']['webCommandMetadata']['url']
|
||||||
cmnt['text'] = Markup(bleach.linkify(concat_texts(raw_comment['contentText']['runs']).replace("\n", "<br>")))
|
cmnt['text'] = Markup(bleach.linkify(concat_texts(raw_comment['contentText']['runs']).replace("\n", "<br>")))
|
||||||
cmnt['date'] = raw_comment['publishedTimeText']['runs'][0]['text']
|
cmnt['date'] = raw_comment['publishedTimeText']['runs'][0]['text']
|
||||||
|
|
||||||
|
try:
|
||||||
|
cmnt['creatorHeart'] = raw_comment['creatorHeart']['creatorHeartRenderer']['creatorThumbnail']['thumbnails'][0]['url']
|
||||||
|
except:
|
||||||
|
cmnt['creatorHeart'] = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cmnt['likes'] = raw_comment['likeCount']
|
cmnt['likes'] = raw_comment['likeCount']
|
||||||
|
Reference in New Issue
Block a user