Detect livestreams on Youtube video search and feed

This commit is contained in:
pluja 2020-09-07 15:19:00 +02:00
parent 40f11fc0c6
commit b6bb2a3cfa
3 changed files with 28 additions and 10 deletions

View File

@ -667,7 +667,6 @@ def getPosts(account):
if userFeed != []: if userFeed != []:
for post in userFeed[:-1]: for post in userFeed[:-1]:
date_time_str = post.find('span', attrs={'class':'tweet-date'}).find('a')['title'].replace(",","") date_time_str = post.find('span', attrs={'class':'tweet-date'}).find('a')['title'].replace(",","")
time = datetime.datetime.now() - datetime.datetime.strptime(date_time_str, '%d/%m/%Y %H:%M:%S')
if post.find('div', attrs={'class':'pinned'}): if post.find('div', attrs={'class':'pinned'}):
if post.find('div', attrs={'class':'pinned'}).find('span', attrs={'icon-pin'}): if post.find('div', attrs={'class':'pinned'}).find('span', attrs={'icon-pin'}):

View File

@ -58,4 +58,4 @@
#toggle:checked ~ .control-me { #toggle:checked ~ .control-me {
visibility: visible; visibility: visible;
cursor: pointer; cursor: pointer;
} }

View File

@ -3,7 +3,11 @@
<img alt="Thumbnail" src="/img/{{video.videoThumb.replace('/', '~')}}"> <img alt="Thumbnail" src="/img/{{video.videoThumb.replace('/', '~')}}">
</div> </div>
<div class="content"> <div class="content">
{% if video.views == "Livestream" %}
<a class="video-title break-word" href="#">{{video.videoTitle}}</a>
{% else %}
<a class="video-title break-word" href="{{url_for('watch', v=video.id, _method='GET')}}">{{video.videoTitle}}</a> <a class="video-title break-word" href="{{url_for('watch', v=video.id, _method='GET')}}">{{video.videoTitle}}</a>
{% endif %}
<div class="meta"> <div class="meta">
<a class="break-word" href="{{url_for('channel', id=video.channelId)}}">{{video.channelName}}</a> <a class="break-word" href="{{url_for('channel', id=video.channelId)}}">{{video.channelName}}</a>
</div> </div>
@ -12,14 +16,29 @@
</div> </div>
</div> </div>
<div class="extra content"> <div class="extra content">
<span class="right floated"> {% if video.views == "Livestream" %}
<i class="eye icon"></i> <span class="right floated">
{{video.views}} <i class="red circle icon"></i>
</span> {{video.views}}
<span class="right floated"> </span>
<i class="clock icon"></i> {% else %}
{{video.timeStamp}} <span class="right floated">
</span> <i class="eye icon"></i>
{{video.views}}
</span>
{% endif %}
{% if video.timeStamp == "Scheduled" %}
<span class="right floated">
<i class="blue clock icon"></i>
{{video.timeStamp}}
</span>
{% else %}
<span class="right floated">
<i class="clock icon"></i>
{{video.timeStamp}}
</span>
{% endif %}
<span> <span>
</span> </span>
</div> </div>